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;
}

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

是不是dll导出函数内部发生指针异常访问了。错误提示是指针错误

看你的 config.dll 是否正确。。调用的是否一致。。。

此为pascal调用此dll的示例,成功

 Uses math;

function ConfigWindows_Open(In_SetValue:int64):int64;
    stdcall; external 'config.dll' name 'ConfigWindows_Open';

Begin
    writeln('You Setting : ',ConfigWindows_Open(random(2**62-1)));
    readln;
End.