PDA

View Full Version : Qt 4.1 - compile regular DLL statically



Elder Orb
11th January 2006, 08:52
Help with subj, plz!

source of QtDll.h
#ifdef QTDLL_EXPORTS
#define QTDLL_API __declspec(dllexport)
#else
#define QTDLL_API __declspec(dllimport)
#endif

extern QTDLL_API void __stdcall Test();

source of QtDll.dll
#include "QtDll.h"
#include <QWidget>
#include <QApplication>

BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
QApplication* a = NULL;
int argc = 0;
char** argv = 0;

switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
a = new QApplication(argc, argv);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
delete a;
a = NULL;
break;
}
return TRUE;
}

QTDLL_API void __stdcall Test()
{
QWidget* w = new QWidget;
w->show();
}

fullmetalcoder
11th January 2006, 09:32
lots of infos but it lacks something ...
what happens when you try to compile it???

I remember that I had troubles when compiling a DLL under mingw32 with the same header file. I removed the "__declspec(dllimport)" and it worked.

Elder Orb
11th January 2006, 10:28
I haven't tried to comile it, because I don't know what must be in a .pro file for regular dll...