从delphi或lazarus调用visual studio dll

问题描述 投票:-3回答:1

我需要从delphi 7或lazarus调用一个dll。关于dll的信息很少,但我在visual studio中有一个例子:声明:

    [DllImport("landwell.dll", EntryPoint = "PTcomm", CharSet = CharSet.Auto)]
    public static extern int PTcomm(int com, int boud, ref int Rcount);
    [DllImport("landwell.dll", EntryPoint = "PTcomm_YPWJ", CharSet = CharSet.Auto)]
    public static extern int PTcomm_YPWJ(int com, int boud, ref int Rcount);

    [DllImport("landwell.dll", EntryPoint = "PTrecord", CharSet = CharSet.Auto)]
    public static extern int PTrecord(int num,byte[] record);

如何在Delphi 7或Lazarus中声明和调用这些函数?

我唯一的文件是:1,Common Transmit:PTcomm(int com,int boud,int * Rcount)Com用于串口号,boud率为9600,* Rcount用于记录总数 “1”表示成功返回,“0”表示没有记录,“ - 1”表示打开端口失败,“ - 2”表示传输失败

2,通用采集数据PTrecord(int num,byte record [8])记录{8}表示8byte(包括读卡器编号),num表示序列号“1”表示返回成功,“0”表示返回失败我只有Visual Studio中的一个例子,我甚至无法尝试,因为它是在旧版本的VS中编写的,并且自动转换不起作用。这时我无意学习VS.该帖子前面提到的声明来自该例子。我被指责甚至不认识那些不了解我并且不知道我做了什么的人。我试过并失败了,这就是我要问的原因。

谢谢,让 - 克劳德

delphi dll lazarus
1个回答
0
投票

在Delphi和Lazarus中尝试这些声明:

function PTcomm(com, boud: Integer; var Rcount: Integer): Integer; stdcall; external 'landwell.dll';

function PTcomm_YPWJ(com, boud: Integer; var Rcount: Integer): Integer; stdcall; external 'landwell.dll';

function PTrecord(num: Integer; rec: PByte): Integer; stdcall; external 'landwell.dll';
© www.soinside.com 2019 - 2024. All rights reserved.