// Delphi代碼(DELPHI版本:渦輪德爾福資源管理器(這是2006年德爾福))如何從C#中調用這個delphi .dll函數?
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中也使用,代碼等, 如果(事件= 1)和(標籤= 10)然後writeln( '登錄結果:',GetLoginResult);)
可能的幫助:http://stackoverflow.com/questions/5086645/how-to-use-delphi-dllwith-pchar-type-in-c-sharp –