0
我有一个MFC应用程序,我从exe中调用mfc dll(vtkMFC.dll)。在那里我得到了一个调试断言,如下面的afxwin1.inl。assert afxcurrentinstancehandle null从exe中调用MFC dll
{ASSERT(afxCurrentInstanceHandle!= NULL);
我试图用AfxSetResourceHandle(GetModuleHandle("vtkMFC.dll"))
,但仍然得到同样的错误。 我正在使用"use MFC in a static library"
选项。 下面是我的代码:
AFX_MANAGE_STATE(AfxGetStaticModuleState()) CWaitCursor WC; // sometimes takes a while to start CCCADApp *app = (CCCADApp *)AfxGetApp(); CFrameWnd *frame = app->pVtkTemplate->CreateNewFrame(this, NULL); // first init creates the view app->pVtkTemplate->InitialUpdateFrame(frame, this, FALSE); CvtkMDIView* view= dynamic_cast<CvtkMDIView*>(frame->GetActiveView()); // // automatic correction - try to load initial field if solution is not available if(run->GetStatus()==CDawesRun::NOTRUN) options=VTKInitialField|VTKGrid|(options & VTKView2D); if(view) view->setData(run,options,variable); // set data // show the view and frame app->pVtkTemplate->InitialUpdateFrame(frame, this, TRUE);
我的主要应用是建立与“多线程调试(/ MTD)”选项,该DLL是建立与多线程调试DLL(/ MDD )。 这是否与此有关? 请帮帮我。
谢谢。
非常感谢Ofek的回复。我的主要项目是静态链接的。所以我无法改变它。我的第三方lib和dll(vtk)文件是动态链接的。更改它们也没有解决问题,因此我直接在主应用程序中使用了提供错误(vtkMFCWindow)的文件,并删除了它的__declspec(dllexport)定义。现在它工作正常。再次感谢。 – gishara 2012-07-19 09:53:01