Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)

UPDATE: 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: http://qt.gitorious.org/qt-solutions/qt-solutions/trees/master/qtwinmigrate EDIT: I believe this is the new link: https://github.com/qtproject/qt-solutions/tree/master/qtwinmigrate)

I used this example to get me going:

http://doc.qt.nokia.com/solutions/4/qtwinmigrate/winmigrate-qt-dll-example.html

EDIT: I believe this is the new link http://htmlpreview.github.io/?https://github.com/qtproject/qt-solutions/blob/master/qtwinmigrate/doc/html/winmigrate-qt-dll-example.html

like image 400
User Avatar asked Feb 23 '11 00:02

User


1 Answers

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.

like image 98
the JinX Avatar answered Oct 09 '22 15:10

the JinX