lifuguan 2016-12-16 13:40 采纳率: 0%
浏览 1119

C++ 调用 dll问题(0x1031DF25 (config.dll)

C++ loadlibrary()动态调用dll
hMod正确
报错:
0x1031DF25 (config.dll)处(位于 Project1.exe 中)引发的异常: 0xC0000005: 执行位置 0x1031DF25 时发生访问冲突

 #include <iostream>
#include <Windows.h>
#include <Cstring>
using namespace std;
int  main()
{
    HINSTANCE hMod = LoadLibrary("config.dll");
    if (hMod == NULL)
    {
        GetLastError();
        cout << "zairushibai" << endl;
        system("pause");
        return 0;
    }
    cout << "input:";
    int QQ_name;
    cin >> QQ_name;
    const char * function_name= "ConfigWindows_Open";
    typedef int64_t(WINAPI * ConfigWindows_Open)(int64_t a);
    ConfigWindows_Open function_test = (ConfigWindows_Open)GetProcAddress(hMod, function_name);
    function_test(QQ_name);
    FreeLibrary(hMod);

    system("pause");
    return 0;
}
  • 写回答

4条回答 默认 最新

  • threenewbee 2016-12-16 14:51
    关注

    config.dll本身怎么写的?ConfigWindows_Open这个在哪里定义的?调用约定是否一致,都是stdcall么?

    评论

报告相同问题?