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 | dd1da59ef0a64834191806535418511a9f35f004 (patch) | |
tree | 6b430779289778373ac0bfa6bd95108fa81f067b /qt/ScintillaEditBase/PlatQt.cpp | |
parent | f0dff024feb1b16e992a84e9c076a0336fdd0bc6 (diff) | |
download | scintilla-mirror-dd1da59ef0a64834191806535418511a9f35f004.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; } |