Solved Unload Qlibrary
-
Hi,
I'm using a DLL with QLibrary in order to control a machine.
I load the library and resole functions.
Then i call an init() function from the library.When the machine is not detected on the network, this function return -1 and i can't unload the library. I close all the windows and the app crash fiew seconds later.
Thx for help
-
Hi
You should be able to call
http://doc.qt.io/qt-5/qlibrary.html#unload
if you are the only instance using the DLL.
Else You cannot unload it.Also
"Note that on Mac OS X 10.3 (Panther), dynamic libraries cannot be unloaded." -
@Zoptune Why does it crash? What does the debugger say?
-
I think I'm the only instance using the DLL
When the machine is detected on the network, unload work fine. -
@Zoptune
Ok. it sounds like the DLL does something in init() when it fails.
You need to look at that code to know. -
@Wieland
When the machine is not detected, my app is useless. So i just close it.
Closing my app call the unload function in an object destructor.
Then i quit and wait the thread where the DLL was used and stop the app.But when all windows are closed and app seems to be stoped, i don't have any message like :
PATH\debug\test.exe exited with code 0
4 or 5 seconds later i have the message :
PATH\debug\test.exe crashed
-
@mrjj
I haven't got the code of the DLL >< -
@Zoptune
Oh. It seems that on fail (-1), it might spawn something or
be in funny state so it sounds like its still active
when App is closed.What DLL is it?
-
@mrjj
It's a DLL provided by the manufacturer of the machine.
They have their own software to control the machine but this software doesn't match my company needs.
So they provided us the DLL and the documentation and i'm developing our soft. -
Hi,
Out of curiosity, why not link your application to that library ? Or do you only got the .dll file ?
-
@SGaist
Yes i only got the DLL file >< -
Hi,
they gave you the DLL and the documentation. So you could ask them about the error.
-Michael. -
@m.sue
I send them an email.I created this topic to ask if it was possible that the problem came from my side.
-
@Zoptune
If you do not touch any function in the DLL after you call init() and it return -1, then
its not likely its in your code.
Also, would be fast to make small test project and test this. -
Hi,
I made several tests and i'm sure that the problem comes from the DLL.
Thx all, and sorry to have wasted your time ^^'