Fixed win32 plugin provider.

svn-id: r33330
This commit is contained in:
Johannes Schickel 2008-07-27 11:07:38 +00:00
parent 4c7420125e
commit 52e3dec37b

View file

@ -50,21 +50,14 @@ protected:
virtual VoidFunc findSymbol(const char *symbol) { virtual VoidFunc findSymbol(const char *symbol) {
#ifndef _WIN32_WCE #ifndef _WIN32_WCE
void *func = (void *)GetProcAddress((HMODULE)_dlHandle, symbol); FARPROC func = GetProcAddress((HMODULE)_dlHandle, symbol);
#else #else
void *func = (void *)GetProcAddress((HMODULE)_dlHandle, toUnicode(symbol)); FARPROC func = GetProcAddress((HMODULE)_dlHandle, toUnicode(symbol));
#endif #endif
if (!func) if (!func)
debug("Failed loading symbol '%s' from plugin '%s'", symbol, _filename.c_str()); debug("Failed loading symbol '%s' from plugin '%s'", symbol, _filename.c_str());
// FIXME HACK: This is a HACK to circumvent a clash between the ISO C++ return (void (*)())func;
// standard and POSIX: ISO C++ disallows casting between function pointers
// and data pointers, but dlsym always returns a void pointer. For details,
// see e.g. <http://www.trilithium.com/johan/2004/12/problem-with-dlsym/>.
assert(sizeof(VoidFunc) == sizeof(func));
VoidFunc tmp;
memcpy(&tmp, &func, sizeof(VoidFunc));
return tmp;
} }
public: public: