動態調用dll,GetProcAddress總是返回NULL呢??

Javpp Javpp 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
dll中

聲明:
extern "C" __declspec(dllexport) int GetAdapterNumber();


定義:

int GetAdapterNumber()
{
return 0;
}


調用:

HINSTANCE instance;
int (_stdcall *get_adapter_number)(void);


instance = LoadLibrary(L"E:\\HWInfo\\Win32\\Debug\\HWInfo.dll");

if(instance)
{
get_adapter_number = (int (_stdcall *)(void))GetProcAddress(instance, "GetAdapterNumber");
}
else
{
ShowMessage("load file error");
}


get_adapter_number總是null。。。

...全文
评论 4
收藏 已收藏
分享
返回顶部
Javpp
C++ Builder 13,871 成员 102,696 内容