[fpc-pascal] fp libraries do not like cmem ?
Fred van Stappen
fiens at hotmail.com
Fri Feb 14 20:06:11 CET 2014
Hello.
It seams to me that i monopolize the forum here.
Please advice if it borrow you, i will stop directly... ;-)
I still fight with cmem and trust me, it is a hard battle.
Mainly because the debugger gives me very few infos and because, if i do not use cmem, all examples are working perfectly, the debugger is happy and do not gives me any warning, only lot of "OK" ...
So difficult to understand why LCL+cmem do not like uos library.
I follow the advices of Tomas and the debugger gives me a (very) few more infos.
One is that:
#8 0x0000000000426ae6 in fpc_ansistr_decr_ref ()
So i isolate the only function who gives as result string (and is working without cmem):
function uos_GetInfoDeviceStr() : String ;
var
myresult : string;
begin
...
result := myresult;
end;
I changed with
function uos_GetInfoDeviceStr() : PChar ;
var
myresult : string;
begin
...
result := @myresult;
end;
And that is ok, no more crash and debugger is happy...
But now, when i try to retrieve the result with, for example :
procedure getinfo ;
var
mystring : string;
begin
mystring := uos_GetInfoDeviceStr();
end;
I get:
=> mystring = '' (empty string).
How must i do to retreive the data of Pchar (the result of uos_GetInfoDeviceStr()) ?
PS : It seams that cmem prefers pointers as result, so, maybe i have to change all functions to give pointers as result (yes/no?).
Many thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140214/33954ec1/attachment.html>
More information about the fpc-pascal
mailing list