[SOLVED] Using LoadLibrary to load a DLL with QString
-
I'm writing a wrapper for a DLL, and want to use the windows API to load it. I understand I'm supposeDd to do it like this:
@LoadLibrary(_T("MyDllFilenameHere.dll"));@But I want to pass the name of the DLL to the class as a QString argument, then to load the specified file by its name.
The _T macro is translated to __T and then to the macro
@#define __T(x) L ## x@Which means that a simple string literal is expected. How can I modify the code to work with my QString parameter?
-
bq. Which means that a simple string literal is expected
No, it means wide-string literal.
Also, why not unicode-aware LoadLibraryW, it's 2012?!Since unicode is on, use "QString::toWCharArray":http://qt-project.org/doc/qt-4.8/qstring.html#toWCharArray.
@LoadLibraryW( filename.toWCharArray() )@