diff options
author | Neil Hodgson <nyamatongwe@gmail.com> | 2013-04-26 11:03:10 +1000 |
---|---|---|
committer | Neil Hodgson <nyamatongwe@gmail.com> | 2013-04-26 11:03:10 +1000 |
commit | cf70aa93d016df4a433d42ab537014ef694c8161 (patch) | |
tree | 8a7f838af4ddbde9d7bfcdca50b2660d654e1e1d /qt/ScintillaEditBase/PlatQt.cpp | |
parent | 3f75bffcfb3bfd803cb494d88722e309620598b7 (diff) | |
download | scintilla-mirror-cf70aa93d016df4a433d42ab537014ef694c8161.tar.gz |
Use union to allow access to dynamic library functions.
Diffstat (limited to 'qt/ScintillaEditBase/PlatQt.cpp')
-rw-r--r-- | qt/ScintillaEditBase/PlatQt.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index fa76f2614..ed2ed99f6 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -1089,8 +1089,17 @@ public: virtual Function FindFunction(const char *name) { if (lib) { - void *fnAddress = lib->resolve(name); - return static_cast<Function>(fnAddress); + // C++ standard doesn't like casts betwen function pointers and void pointers so use a union + union { +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QFunctionPointer fp; +#else + void *fp; +#endif + Function f; + } fnConv; + fnConv.fp = lib->resolve(name); + return fnConv.f; } return NULL; } |