PDA

View Full Version : Qt + LoadLibrary + Windows



desantossierra
14th June 2012, 11:32
Hi,
first, sorry for my english.

I'm a developer that are doing a multiplatform app using C++ and Qt, but I have to use LoadLibrary to open a DLL, because the library and C files are not mine.

My application has to work in Window 32 or 64 bit and Linux 32 or 64 bit (in Linux is working now)

I'm using this sentence to load the library:
HINSTANCE h = LoadLibrary("nsNEVLibrary.dll");
the returned "h" is 268435456 that is not a valid library handle
and GetLastError return 127

nsNEVLibrary.dll is located in C:\Neuroshare\NeuroshareLibraries and this path is in my environment variable path
I run "dependecy walker" to check if I have some missing libraries but no, I have all needed libraries in my C:\windows\system32

Can anybody help me?
Thank you in advance.

wysota
14th June 2012, 11:34
First of all use QLibrary.

desantossierra
14th June 2012, 12:21
I used but no works:



if (QLibrary::isLibrary("nsNEVLibrary.dll")) {
QLibrary lib("nsNEVLibrary.dll");
if (!lib.isLoaded()) {
qDebug() << lib.errorString();
}
}


The returned string is: "Unknow error"

wysota
14th June 2012, 12:47
Maybe you should call load() first?

desantossierra
14th June 2012, 12:53
ou
sorry, I didn't try it.

Thank you