// Delphi代码(Delphi版本:Turbo Delphi Explorer(即Delphi 2006))
function GetLoginResult:PChar;
begin
result:=PChar(LoginResult);
end;
//以下是C#代码使用上面的Delphi函数(我正在使用Unity3d,在C#中)
[DllImport ("ServerTool")]
private static extern string GetLoginResult(); // this does not work (make crash unity editor)
[DllImport ("ServerTool")]
[MarshalAs(UnmanagedType.LPStr)] private static extern string GetLoginResult(); // this also occur errors
如何正确使用C#中的该函数?
(在Delphi中也可用,代码如下,如果 (event=1) 并且 (tag=10) 则写入 '登录结果: ' 和 GetLoginResult;)