delphi如何调用VB编写的DLL函数
我在delphi调用VB编写的DLL函数碰到个问题,请各位大侠帮忙看下。
VB本身调用该DLL文件,按以下方式定义
Declare Function read Lib "JNDll.dll" Alias "rrrr" (ByRef syscode$, ByRef gas_total As Long) As Integer
在调用该DLL的VB中使用以下调用
Dim syscode$
Dim gastotal As Long
st As Integer
st = read(syscode, gastotal)
在VB中执行正确。
请教在delphi中该如何定义?
我在delphi中定义函数时,将变量syscode分别定义为string/widestring/pchar/PWideChar,gastotal分别定义为integer/longint/pinteger/PLongint,结果均报错。错误信息:
access violation as oX10002228:write of address 0x0045b2b0
delphi函数定义我是这么定义的
read:function(var syscode:PChar;var gas_total:PInteger):Integer;
调用部分这么写的
H := LoadLibrary(pchar('JNDll.DLL'));
read:=GetProcAddress(H, 'rrrr');
errorno:=read(syscode,gas_total);
STDCALL
read:function(var syscode:PChar;var gas_total:PInteger):Integer;stdcall;.....