【发布时间】:2012-06-24 06:51:19
【问题描述】:
//delphi代码(delphi版本:Turbo Delphi Explorer(Delphi 2006))
function GetLoginResult:PChar;
begin
result:=PChar(LoginResult);
end;
//使用上面delphi函数的C#代码(我用的是unity3d,inside,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中使用,代码就像, if (event=1) and (tag=10) then writeln('登录结果:',GetLoginResult); )
【问题讨论】: