I have some problems transferring data for delphi imported activeX control in c# environment.
I have a function on delphi side, which takes and returns PChar. I can modify it or do whatever I want with it.
function TActiveFormX.DelphiFunction(S: PChar): PChar;
begin
///do something with 'S'
result:=S;
end;
And on C# side of the program is a function, which calls delphi function, giving it a string parameter to chew on.
public void CSharpFunction()
{
string a = axActiveFormX1.DelphiFunction("sampleString");
}
I've tested it and apparently everything goes well until C# receives returned PChar. Then whe whole application stops responding and exits. I tried to implement try-catch block to see the Exception message, but the app just crashes before displaying anything.
I suppose it crashes because of variables not being of the same type. Or because of cruel software version mismatch: Delphi 5 + Visual Studio 2012. I googled this, but no luck thus far.
Any help appreciated :)