delphi中的DLL中的声明原码如下:
这里声明了输出性参数分别为数字与字符类型
library dll1;
uses
SysUtils,
Classes;
{$R *.res}
Function mymax(x, y: Integer; out jj: Integer; out abc: PChar): Integer; stdcall;
begin
jj := x * y;
abc := PChar(StrPas(abc) + '这是传出的');
if X > Y then
Result := X
else
Result := Y;
end;
exports mymax;
begin
end.
vb中的调用程序如下:
Private Declare Function mymax Lib "C:/lx/delphi/lx1/dll1.dll" (ByVal sj1 As Long, ByVal sj2 As Long, ByRef sj3 As Long, ByRef s1 As String) As Long
Private Sub Command1_Click()
Dim s_t As String
Text3.Text = ""
sj3_v = 0
s_t = "测试输入:"
Text3.Text = mymax(Val(Text2.Text), Val(Text1.Text), sj3_v, s_t)
Print (Str(sj3_v) + s_t)
End Sub