User User - 10 months ago 92
C++ Question

Qt: How to create windows DLL (that exports functions)?

I need to create a windows DLL that exports functions and has a graphical user interface. The reason for the GUI in the DLL is that the DLL serves as a kind of plugin for another 3rd party application. Currently I only have access to Visual Studio Express which AFAIK doesn't support MFC so I'm looking for alternative ways to create a GUI in a DLL. After some research I came across Qt which seems promising. And it seems like it might be easier to just use the Qt Creator IDE rather than Visual Studio Express.

However, how do I create a windows DLL in Qt Creator? (I guess a regular DLL, I don't think a COM or managed DLL will work)

I got this working! After jumping through several hoops, two important keys were to add

#include <windows.h>

And then to use the Qt/MFC Migration Framework tool (currently officially available at: EDIT: I believe this is the new link:

I used this example to get me going:

EDIT: I believe this is the new link

Answer Source

Add the folowing line to the .pro file: TEMPLATE = lib

That's just about all you'll have to do to have QtCreator make your 'app' into a dll.