PDA

View Full Version : Recompiled DLL now requiring libs



Momergil
14th August 2013, 20:54
Hello!

Recently I was using a old version of MinGW, Qt Creator and Qt 4.8.1 to create and compile a .dll in the same format as the one explained in the English Wikipedia article about DLLs (). There was no usage of Qt at all, just C code (using that "extern "C"" thing). This .dll was then load at run time by an application, and everything run happy and fine.

But now I updated by programmer tools (MinGW, QtCreator maybe and Qt to 5.1.0) and although I could compile my .dll all fine, when I run the library at run time two successive errors appear, both of them essentially saying that a given .dll was missing - namely, libstdc++-6.dll and libwinpthread-1.dll. When I included both libs in the same folder where my .dll is located, then once again everything run fine.

My question, then, is: why do I need now to include those files - specially taking in consideration that before such wasn't required? And is there I way by witch I can revert this situation - compiling my lib with the current kit but without having to add those dlls with it?

Thanks,

Momergil

ChrisW67
15th August 2013, 03:39
Since we have no idea what compiler and linker commands you used to build your DLL we really cannot be specific. One library is specific to C++ so that's one clue. The other is probably required by the first, but it's hard to say.

Oh, and BTW, if you are loading the DLL from a Qt application then these dependencies are probably from the Qt 5 libs and not your DLL.

Momergil
15th August 2013, 15:34
Since we have no idea what compiler and linker commands you used to build your DLL we really cannot be specific. One library is specific to C++ so that's one clue. The other is probably required by the first, but it's hard to say.

Well, regarding the compiler it's MinGW 4.8 32 bit (the new one). Regarding commands to build, these are the default that appear when you begin to create a dll. more specific: qmake: qmake.exe Lfmd-HIS-HSL.pro -r -spec win32-g++, Make: mingw32-make.exe in C:\Users\Endrigo\Desktop\Lfmd-HIS-HSL.


Oh, and BTW, if you are loading the DLL from a Qt application then these dependencies are probably from the Qt 5 libs and not your DLL.

Actually not, I'm loading it from a Borland Builder C++ 6 application, using Windows API functions (LoadLibrary, GetProcAddress, etc.). Just as it's in Wikipedia :)

Btw, today I was going to use the system again and know it asked for another .dll: libgcc_s_dw2-1.dll. And that's at least funny...

ChrisW67
15th August 2013, 23:13
Have you dropped your DLL into Dependency Walker to see what it is dependent on in isolation form the application?

If you are using QMake to build your completely non-Qt DLL for use in your non-Qt application (I wonder why) then ensure your PRO file has:


CONFIG -= qt

Momergil
22nd August 2013, 19:39
has... ?

Yep, dependency walker tells about the need for libgcc_s_dw2-1 and libstdc++-6 dlls (libwinpthread-1.dll is not mentioned). But the point here is that before, such dependency didn't exist at all (as I was fully capable of running and using the DLL without the need for such libs to be in the same folder as my .dll).

ChrisW67
22nd August 2013, 21:28
If you are using QMake to build your completely non-Qt DLL for use in your non-Qt application (I wonder why) then ensure your PRO file has:


CONFIG -= qt

I don't know where that went because it was there to quote.

You are complaining that your new Ferrari is built from Ferrari components when the Porsche you used to drive got by fine on Porsche components. You have changed Qt (4.8 to 5.1) and C++ compilers (probably gcc 4.4 to 4.8) and the new version is built and does things differently.