//Visual Basic
Public Declare Function GetMsg Lib "../dlltest.dll"
(ByRef Str As String) As Boolean
Private Sub Command1_Click()
[red]Dim Str As String * 100[/red]
On Error Resume Next
If GetMsg(Str) then
Text1.Text = Str
else
MsgBox "error"
End If
End Sub
//Delphi
function GetMsg(var Str: PChar): BOOL;
stdcall;
begin
try
StrPCopy(Str,'this is a string from dll');
Result := True;
except
on Exceptiondo
Result := False;
end;
//except
end;