这个dll调用错在哪里???

brytison 2004-05-03 11:13:42
调用:
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那里……都给弄糊涂了~~不知道哪里找原因了,中断出来的都是汇编指令。
...全文
37 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
brytison 2004-05-05
  • 打赏
  • 举报
回复
晕哦,没有下文啦????~结帖~~~
brytison 2004-05-04
  • 打赏
  • 举报
回复
Use MFC in a static library

extern "C"是为兼容C调用啊!~
.def我根本不输出的,就使用__declspec(dllexport)输出。
但总是在ntdll!里中断~~~~
醉马不肖 2004-05-04
  • 打赏
  • 举报
回复
不知道什么意思
brytison 2004-05-04
  • 打赏
  • 举报
回复
谢谢anothervip(cadet),导出MFC的都需要(必须?)是扩展dll?stdcall调用又是怎样的?我用寻址方式啊,像上面那样。
anothervip 2004-05-04
  • 打赏
  • 举报
回复
我是指你的dll,你要导出mfc的东西就要用扩展dll。

如果在mfc的程序中使用dll,dll就没必要extern "C"。

如果是stdcall调用,你不加def文件。。。。
anothervip 2004-05-03
  • 打赏
  • 举报
回复
你是用扩展dll吗?
你为什么加extern "C"?

你的def文件是怎么写的
brytison 2004-05-03
  • 打赏
  • 举报
回复
第二行不是的,多加了。

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧