I have made a simple DLL with lazarus 1.6.2 with 2 function:
function GetValue : PAnsiChar; cdecl;
var
aStr : String;
Temp : PAnsiChar;
begin
aStr := 'wewewewewewe';
Result := StrAlloc(Length(aStr));
Temp := Addr(aStr[1]);
StrCopy(Result, Temp);
end;
procedure FreeString(strin: PAnsiChar); cdecl;
begin
StrDispose(strin);
end;
When I call this function from host program, after some call to these functions, the program closes by itself. Can anyone tell me why? How can I find out why? How can I fix the problem?
Thank you