我按照此链接中提到的方法创建了以下内容:https://ccplz.net/threads/building-a-qt-dll-with-gui.44178/
在我的QT Appication中调用Iapp,我设置了必要的配置并输出了输出Iapp.dll
int main(int argc, char *argv[])
{
argc =0;
QApplication MyApp(argc, NULL);
MyMainGuiObject obj;
obj.show();
return MyApp.exec();
}
BOOL APIENTRY DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpReserved)
{
UNREFERENCED_PARAMETER(lpReserved);
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
{
HANDLE hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)main, (LPVOID)hInstance, 0, NULL);
if (hThread != NULL)
break;
else
return FALSE;
}
}
return TRUE;
}
在我的MFC程序中,我尝试加载dll
hDLL = LoadLibrary(“Iapp”);
但它返回null值...有人知道这里有什么问题吗? (顺便说一句,我尝试使用qt向导创建一个qt dll,它可以加载但是ofcos它的qt dll没有gui)