我自己写了一个dll,其中有一个导出函数:
extern "C" void PASCAL EXPORT Test(CString str1,CString str2,......)我在vc里调用的时候这样的: HINSTANCE handlerDll=NULL;
typedef void (*Test)(CString,CString,.....);
Test test; if(handlerDll==NULL)
{
handlerDll=LoadLibrary("GZHBDll.dll");
}
test=(Test)GetProcAddress(handlerDll,"Test");
CTryApp* pApp=(CTryApp*)AfxGetApp();
CTestDllDlg testDllDlg;
if(testDllDlg.DoModal()==IDOK)
{
if(handlerDll==NULL)
{
AfxMessageBox("加载动态链接库失败!");
return;
}
test(str1,str2,......);
}
handlerDll=NULL;请各位大哥看看,这里错在哪里,为什么test函数可以执行,但是无论在哪里test返回总是有assert错误(test可以执行到底,但是一旦返回就错了)
extern "C" void PASCAL EXPORT Test(CString str1,CString str2,......)我在vc里调用的时候这样的: HINSTANCE handlerDll=NULL;
typedef void (*Test)(CString,CString,.....);
Test test; if(handlerDll==NULL)
{
handlerDll=LoadLibrary("GZHBDll.dll");
}
test=(Test)GetProcAddress(handlerDll,"Test");
CTryApp* pApp=(CTryApp*)AfxGetApp();
CTestDllDlg testDllDlg;
if(testDllDlg.DoModal()==IDOK)
{
if(handlerDll==NULL)
{
AfxMessageBox("加载动态链接库失败!");
return;
}
test(str1,str2,......);
}
handlerDll=NULL;请各位大哥看看,这里错在哪里,为什么test函数可以执行,但是无论在哪里test返回总是有assert错误(test可以执行到底,但是一旦返回就错了)
typedef void (*Test)(CString,CString,.....);
^
typedef void (PASCAL *Test)(CString,CSring,......);
LINK : warning LNK4089: all references to "OLEPRO32.DLL" discarded by /OPT:REF
LINK : warning LNK4089: all references to "RPCRT4.dll" discarded by /OPT:REF
LINK : warning LNK4089: all references to "ole32.dll" discarded by /OPT:REF这样的警告怎么解决,是什么样的错误,好像就是在调用了我的dll后才出现的警告
the warning you can ignore it.
建议使用LPCSTR 或LPSTR
最好是传递地址!如char *