调用dll结束时出错
void CTestDlg::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
typedef /*CDialog* */(WINAPI * MAPDLL)(/*CDialog* pDlg,*/ CString sText/*, CWnd* wnd=NULL*/);
HINSTANCE hmod;
hmod = ::LoadLibrary ("MapDll.dll");
if(hmod==NULL)
{
AfxMessageBox("Failed to load dll file!");
}
MAPDLL lpproc;
lpproc = (MAPDLL)GetProcAddress (hmod,"ShowMap");
CString sText = "This is a test!";
if(lpproc!=(MAPDLL)NULL)
/*pDlg2 = */(*lpproc)(/*pDlg, */sText);
FreeLibrary(hmod);
OnOK();
}
在函数结束的时候会弹出一个对话框。
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.