I reject my decision, as I cheated on him a bit and did not find it in any of the answers.
The C ++ function is as follows:
int __stdcall DoSomething(char * _name);
To make it work in Delphi, I declare the following function
function DoSomething(name: PAnsiChar): integer; stdcall; external 'somedll.dll';
And then when I make the call, I have a function that looks like this:
var s: PAnsiChar; begin GetMem(s, 255); DoSomething(s);
I tried using PChar instead of PAnsiChar, but all I get in return is trash. Also, if I declare a function in Delphi with the parameter set to var, I get an exception when I try to read it.
Hope this helps anyone.
source share