65,208
社区成员
发帖
与我相关
我的任务
分享QLibrary myLib("SJJ1009forformalchip.dll");
if(myLib.load())
{
qDebug("load dll success....");
typedef int (_stdcall *MyPrototype)(char*,char*,char*);
MyPrototype ConnectDevice = (MyPrototype) myLib.resolve("ConnectDevice");
if (ConnectDevice)
{
qDebug("load function ok...");
ret = ConnectDevice(ip,port,time);
}
else
qDebug("load function failed...");
}
else
qDebug("load dll failed...");#include<stdio.h>
#include<windows.h>
typedef int (_stdcall *MyPrototype)(char *,char *,char *);
extern int _stdcall ConnectDevice(char*,char*,char*);
int main()
{
HMODULE glibsample;
MyPrototype ConnectDevice = NULL;
char ip[]="192.168.1.128";
char port[]="6666";
char time='3';
int ret = -1;
glibsample = LoadLibrary("SJJ1009forformalchip.dll");
if(glibsample)
{
printf("get dll ok...\n");
ConnectDevice=(MyPrototype)GetProcAddress(glibsample,"ConnectDevice");
if(ConnectDevice)
{
ret = ConnectDevice("192.169.0.1","6666",&time);
printf("ret=%d\n",ret);
}
else
printf("GetProcAddress failed...\n");
}
else
printf("load dll failed...\n");
return 0;
}