|
2bb5f487
|
2019-07-25T20:34:46
|
|
Fix gcc warning: ISO C forbids return between function pointer and void *
Instead of using compiler specific pragma to disable particular warning,
rewrite code which cast from function pointer to data pointer according to
POSIX dlopen() documentation. This also fix compile warning under MSVC.
According to the ISO C standard, casting between function
pointers and 'void *', as done above, produces undefined results.
POSIX.1-2003 and POSIX.1-2008 accepted this state of affairs and
proposed the following workaround:
*(void **) (&cosine) = dlsym(handle, "cos");
This (clumsy) cast conforms with the ISO C standard and will
avoid any compiler warnings.
|