DLLs created with Qt 4.7 and MS Visual Studio windows apps
-
for Desktop Windows targets, is there a way to link a DLL created with Qt 4.7 (contains network, sql, core modoules) to a Windows Console app? I created the Windows console app with Visual Studio C++ (2010 express), and I want my windows console app to use another DLL i previously created with Qt. Obviously you can just add MyDLL.lib in the VS Linker Input property sheet, but there is more to it...the runtimes.
Are they any deployment complications with mixing such DLLs and the different VC Runtimes? any rules in choosing the windows target (vs05, vs08, mingw) in Creator, etc... Has anyone done it before?
thanks
j.q.
-
The console has no dependance to the runtime, definitly no.
And Qt librarie are jurst librries.
You can create console apps and link all Qt libs in it (even QtGui), that works. But you MUST use the same C-Runtime (/Md /MDd etc) as the libraries, as they are not memory newtral at the interface.
And all Dlls that export C++ and that are used in the executable must be build with the same compiler (als same version).
As you said, a Dll you build previosly, is it build witha nother compiler or version? Is the interface memory newtral? Is Qt only uised by this dll? ...
-
thanks Gerolf, I appriciate your sensible answer. The DLL previously built used creator, and uses only Qt (and both C and C++/STL standard libraries). and I tried both mingw, and vs 08 in debug mode. Based on your answer, the Qt lib works correctly with VS 2010 (Express) only if the Qt librares are recompiled with Visual Studio 2010 (E).
Sounds like I cannot rely on Creator as it does not pick up that version of VS compiler I have installed on my machine.
Judging from other thread discusssions, I have to build the Qt libraries myself with Visual Studio 2010 (Express) before I can generate my Qt DLL with qmake & vs, and link it to the VS 2010 console app.
By the way, how do you judge if the Qt libraries versions used have an interface that is "memory neutral"? Do you refer to the QObject hierarchy memory managment? or a lower level of the native code?
-
Hi qt_dev,
first of all, QtCreator is an IDE, not a compiler. It uses the compilers, you tell him. And it uses teh Qt libraries, you tell him. You can use MS tool chain or mingw tool chain of any version.
Creator does not compile Qt itself. By default, the Qt SDK uses mingw compiler, but you can change that and also build Qt with the needed compilers. But that's something you are responsibvle for, not Creator. Creator calls qmake + the needed make tool.
Qt is not memory neutral. By memory neutral, I talk about libraries that don't give out own allocated memory for outside destruction and vice versa. Afaik, xerces does it that way. You get memory from it, but have to call a delet function from that lib. Or you have to give memory into the lib which will then be filled.
Qt is NOT memory neutral (look at QObject, which destroys it's children, whcih are created somewhere....).