以下是用delphi写的 dll 里面的函数
function PortOpen(Port: longint): longint;
function setDeviceMute(IsMute:Longint;AliasID,waittime:Longint):Longint;
function ReadDeviceRecords(aliasid,waittime:Longint;var PmRecordData:pchar;var REC_COUNT:Longint):longint;
在VC里如何定义 来调用这三个函数呢
function PortOpen(Port: longint): longint;
function setDeviceMute(IsMute:Longint;AliasID,waittime:Longint):Longint;
function ReadDeviceRecords(aliasid,waittime:Longint;var PmRecordData:pchar;var REC_COUNT:Longint):longint;
在VC里如何定义 来调用这三个函数呢
long __stdcall PortOpen(long Port);
如果没有lib文件,
使用dll前先执行LoadLibrary,然后用GetProcAddress分别取这三个函数的指针,使用完dll后FreeLibrary。
typedef long (__stdcall *PORTOPENFUNCTION)(long Port);HMODULE library = LoadLibrary("xxx.dll");
PortOpen = (PORTOPENFUNCTION)GetProcAddress(library, "PortOpen");FreeLibrary(library);