On 06/19/2012 11:19 AM, Rich Felker wrote: >> POSIX is at liberty to define semantics that are not guaranteed by >> C99/C11, and dlsym() is one of those situations where POSIX has indeed >> required more from the compiler (including that function pointers can be >> cast to void* and back again without ill effects). As written in >> http://austingroupbugs.net/view.php?id=74, >> >> Note that conversion from a void * pointer to a function pointer >> as in: >> >> fptr = (int (*)(int))dlsym(handle, "my_function"); >>
> I'm not talking about this; this is actually the correct way to do it. > But the POSIX documentation for dlsym contains an example: > > *(void **)(&fptr) = dlsym(handle, "my_function"); That documentation was rendered obsolete by http://austingroupbugs.net/view.php?id=74, which was intentionally written in part with the aliasing problem in mind. In other words, POSIX no longer recommends writing *(void**)(&fptr), and you are complaining about something that has already been fixed. When the POSIX 2008 Technical Corrigendum is released (most likely later this year, as it is already in balloting), bug 74 is one of the bugs fixed in that corrigendum. -- Eric Blake ebl...@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature