Am 13.12.2010 22:43, schrieb Matthias Klumpp:
On Mon, 13 Dec 2010 22:34:38 +0200, Juha Manninen
<juha.mannine...@gmail.com> wrote:
Matthias Klumpp kirjoitti maanantai 13 joulukuu 2010 18:50:46:
if obj^ = nil then exit;
FreeAndNil(obj^);
Shouldn't it be:
// if obj = nil then exit;<-- not really needed
FreeAndNil(obj);
Yes, right. The first line was only for testing. But removing the line, of
course, does not affect the behavior in any way, which means the error is
still present.
Did you notice that Juha removed the "^" after "obj" as well? How is
PObject defined? Maybe you should just work with TObject directly, cause
a class instance variable is already a pointer.
So:
function create_fpc_class_xy: TObject; cdecl;
begin
Result := TClassXY.Create;
end;
procedure free_fpc_class(aObject: TObject); cdecl;
begin
aObject.Free;
end;
In c:
void* create_fpc_class_xy();
void free_fpc_class(void* aObject);
Regards,
Sven
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal