沒看到 呼叫的程式 的源碼?
只是初步看起來,不像 .dll 本身的問題.
因為已經可以叫到裡面了,而裡面看起來沒有什麼邏輯錯誤.
另外,我自己寫了一個簡單的測試程式去測,看起來 .dll沒有問題,而且不會當機.
//------------------------------------------------------------
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include "dll.h"
using namespace std;
typedef int (CALLBACK* LPFNDLLFUNC1)(char *,int ,int );
int main(int argc, char *argv[])
{
HINSTANCE hDLL; // Handle to DLL
LPFNDLLFUNC1 lpfnDllFunc1; // Function pointer
hDLL = LoadLibrary("專案1.dll");
if (hDLL != NULL)
{
lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,
"WriteMarketPosition");
if (!lpfnDllFunc1)
{
// handle the error
FreeLibrary(hDLL);
return -1;
}
else
{
// call the function
lpfnDllFunc1("test16887",2,9951);
}
}
system("PAUSE");
return EXIT_SUCCESS;
}
// -----------------------------