Delphi 中如下
Function DllInit(SerialNo :PChar) :WordBool ;请中VC++中如何调用?程序如下,但调用rtCode = ifx_init(LPSTR("172.17.155.14"));时出错typedef short (*CLK_INIT)(LPSTR);
typedef void (*CLK_FREE)();
int main(int argc, char* argv[])
{
HINSTANCE hDLL;
BOOL fFreeResult; hDLL = LoadLibrary(TEXT("ID_POS"));
if (hDLL != NULL) {
CLK_INIT ifx_init;
CLK_FREE ifx_free;
short rtCode=0; ifx_init = (CLK_INIT) GetProcAddress(hDLL, TEXT("DllInit"));
if (ifx_init != NULL)
rtCode = ifx_init(LPSTR("172.17.155.14"));
printf("%d\n",rtCode); fFreeResult = FreeLibrary(hDLL);
}
return 0;
}
Function DllInit(SerialNo :PChar) :WordBool ;请中VC++中如何调用?程序如下,但调用rtCode = ifx_init(LPSTR("172.17.155.14"));时出错typedef short (*CLK_INIT)(LPSTR);
typedef void (*CLK_FREE)();
int main(int argc, char* argv[])
{
HINSTANCE hDLL;
BOOL fFreeResult; hDLL = LoadLibrary(TEXT("ID_POS"));
if (hDLL != NULL) {
CLK_INIT ifx_init;
CLK_FREE ifx_free;
short rtCode=0; ifx_init = (CLK_INIT) GetProcAddress(hDLL, TEXT("DllInit"));
if (ifx_init != NULL)
rtCode = ifx_init(LPSTR("172.17.155.14"));
printf("%d\n",rtCode); fFreeResult = FreeLibrary(hDLL);
}
return 0;
}
hmod = ::LoadLibrary ("imuLink.dll");
if(hmod==NULL) {
AfxMessageBox("Fail");
return FALSE;
}
typedef void (WINAPI * IMULINK)(char x[10]);
IMULINK lpproc;
lpproc = (IMULINK)GetProcAddress (hmod,"SetHttp");
if(lpproc == (IMULINK)NULL) {
AfxMessageBox("Fail");
return FALSE;
}
(*lpproc)("ssss");