I own a string in memory allocated by a DLL written in C and assigned to a PChar the ShowMessage () I can see correct values. The only thing I can do is to free the memory area occupied. So I decided to use the passing FreeMem PChar but I SIGSERV returns an error. Does anyone know how to address the problem? 
Hello,
Most DLLs written in C (in Windows) are being linked against msvcrt.dll which handles the memory management. You can try (if the memory allocated in such strings is high along the program life) to dynamic load that DLL and call the "free" method in this DLL. Load time link could work also, but I think it is better a dynamic approach.
type
Tmsvcrt_free=procedure (P: pointer);
var
c_free: Tmsvcrt_free;
begin
h:=LoadLibrary('msvcrt.dll');
c_free:=Tmsvcrt_free(GetProcAddress(h,'free'));
end;
c_free(mypcharvar);
I had not tested this, use at your own risk
