delphi撰寫的函式:
//定義供外部呼叫的函式StrAddStr
function StrAddStr(inpustr:PChar ;var OutPutstr:PChar):integer;stdcall;
var
str1:string;
begin
str1:=inpustr;
OutPutstr:=Pchar(str1 + ' + ' + str1);
showmessage(OutPutstr);
result:=0;
end;
vb呼叫正常:
Public Declare Function StrAddStr Lib "Mydll.dll" (ByVal str1 As String, ByRef str2 As String) As Integer
Dim str1, str2 As String
str1 = "A1abx"
StrAddStr str1, str2
MsgBox str2
pb呼叫例外:
function int StrAddStr(string str1, ref string str2) library "Mydll.dll"
string ls_1 = "Axc"
string ls_2 = space(20)
StrAddStr(ls_1, ls_2)
messagebox(string(len(ls_2)), ls_2)
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/268207.html
標籤:API 調用
