这个dll调用错在哪里???
调用:
HINSTANCE m_hInst_Ex;
m_hInst_Ex = LoadLibrary(".\\Moduals\\order.dll");
typedef int* ShowTDialog(CString strSeatCode);
ShowTDialog* dFun;
m_hInst_Ex = LoadLibrary(".\\Moduals\\order.dll");
if(m_hInst_Ex == NULL)
{
AfxMessageBox("Not found file.(\\moduals\\order.dll)");
return;
}
dFun = (ShowTDialog*)GetProcAddress(m_hInst_Ex,"ShowThisDialog");
if((ShowTDialog*)NULL == dFun)
{
AfxMessageBox("File not fixed.");
return;
}
*dFun(strSeatCode);
FreeLibrary(m_hInst_Ex);
DLL输出函数没有问题。以下:
extern "C" __declspec(dllexport) int ShowThisDialog(CString strSeatCode)
{
AFX_MANAGE_STATE(::AfxGetStaticModuleState());
COrderDlg dlg;
dlg.DoModal();
return 0;
}
每次都是中断在ntdll.dll那里……都给弄糊涂了~~不知道哪里找原因了,中断出来的都是汇编指令。
问题点数:50、回复次数:7Top
1 楼brytison(辉子)回复于 2004-05-03 23:16:07 得分 0
第二行不是的,多加了。
Top
2 楼anothervip(Never ending... ...)回复于 2004-05-03 23:52:59 得分 0
你是用扩展dll吗?
你为什么加extern "C"?
你的def文件是怎么写的Top
3 楼zfive5(醉马不肖)回复于 2004-05-04 08:50:03 得分 0
不知道什么意思Top
4 楼brytison(辉子)回复于 2004-05-04 11:35:38 得分 0
Use MFC in a static library
extern "C"是为兼容C调用啊!~
.def我根本不输出的,就使用__declspec(dllexport)输出。
但总是在ntdll!里中断~~~~Top
5 楼anothervip(Never ending... ...)回复于 2004-05-04 13:42:43 得分 50
我是指你的dll,你要导出mfc的东西就要用扩展dll。
如果在mfc的程序中使用dll,dll就没必要extern "C"。
如果是stdcall调用,你不加def文件。。。。Top
6 楼brytison(辉子)回复于 2004-05-04 14:29:36 得分 0
谢谢anothervip(cadet),导出MFC的都需要(必须?)是扩展dll?stdcall调用又是怎样的?我用寻址方式啊,像上面那样。Top
7 楼brytison(辉子)回复于 2004-05-05 10:41:42 得分 0
晕哦,没有下文啦????~结帖~~~Top




