开发者

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

开发者 https://www.devze.com 2023-02-12 14:02 出处:网络
I need to create a windows DLL that exports functions and has a graphical user interface.The reas开发者_高级运维on for the GUI in the DLL is that the DLL serves as a kind of plugin for another 3rd par

I need to create a windows DLL that exports functions and has a graphical user interface. The reas开发者_高级运维on 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


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.


check qt plugins http://cartan.cas.suffolk.edu/qtdocs/plugins-howto.html

0

精彩评论

暂无评论...
验证码 换一张
取 消