L
lucklark
Unregistered / Unconfirmed
GUEST, unregistred user!
我在用VC++ 调用C++Builder 遍的dll中的函数时编译通过,但运行时出现"应用程序错误:
"0x00000000"指令引用的"0x00000000"内存.该内存不能为"read"",
请问大家知道是怎么回事吗?
#include "stdafx.h"
typedef bool(__stdcall *_DengluDialog)();
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
bool i;
MessageBox(0,"project2.dll测试","Test",MB_OK);
HINSTANCE hDLL;
_DengluDialog MyDengluDialog;
hDLL = ::LoadLibrary("project2.dll");
if (hDLL){
MyDengluDialog = (_DengluDialog)GetProcAddress(hDLL, "DengluDialog");
i=MyDengluDialog();
if (i){
MessageBox(0, "SUCESS","",MB_OK);
MyDengluDialog();
}else
MessageBox(0, "函数导入失败!","",MB_ICONERROR);
}else
MessageBox(0, "无法加载动态链接库!","",MB_ICONERROR);
::FreeLibrary(hDLL);
return 0;
}
单步调试在 MyDengluDialog = (_DengluDialog)GetProcAddress(hDLL, "DengluDialog");
出错
"0x00000000"指令引用的"0x00000000"内存.该内存不能为"read"",
请问大家知道是怎么回事吗?
#include "stdafx.h"
typedef bool(__stdcall *_DengluDialog)();
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
bool i;
MessageBox(0,"project2.dll测试","Test",MB_OK);
HINSTANCE hDLL;
_DengluDialog MyDengluDialog;
hDLL = ::LoadLibrary("project2.dll");
if (hDLL){
MyDengluDialog = (_DengluDialog)GetProcAddress(hDLL, "DengluDialog");
i=MyDengluDialog();
if (i){
MessageBox(0, "SUCESS","",MB_OK);
MyDengluDialog();
}else
MessageBox(0, "函数导入失败!","",MB_ICONERROR);
}else
MessageBox(0, "无法加载动态链接库!","",MB_ICONERROR);
::FreeLibrary(hDLL);
return 0;
}
单步调试在 MyDengluDialog = (_DengluDialog)GetProcAddress(hDLL, "DengluDialog");
出错