I have a C DLL that returns a pointer to a PAnsiChar string managed by the C DLL. I would like to make a copy of the string so that it can be managed on the Delphi side.
If I cast the returned PAnsiChar to an AnsiString, as in "str := AnsiString (myPAnsiChar)" what does the cast actually do? Does the cast allocate new memory for the string pointed to by PAnsiChar or should I make a copy of the string coming from the DLL first?