[Openal-devel] FreeALUT dynamicly loading ogg/vorbis
Sherief N. Farouk
sherief at mganin.com
Tue Jun 10 21:00:54 PDT 2008
> Yeah, I'd imagine there wouldn't be a problem with portability. My main
> problem is what to do with the warnings. If I do the casting in the
> example
> in that page:
> *(void **)(&fptr) = dlsym(handle, "my_function");
>
> I get:
> warning: dereferencing type-punned pointer will break strict-aliasing
> rules
>
> which is actually more serious since breaking strict-aliasing rules can
> break
> code, as opposed to just being told "ISO C doesn't like that".
>
> The only thing I can think of to clear the warnings is to remove the
> ansi/pedantic flags, but I'm not sure if that's acceptable.
[Sherief N. Farouk]
The least damaging solution I could think of is making your own dlfn() function that houses the void* -> function* cast, and have that be exempt from strict compatibility. At least it isolates the "non-conformant" part, and it's a simple trampoline-like function.
- Sherief
More information about the Openal-devel
mailing list