[fpc-pascal]parameter is 0x0 on callback

Peter Vreman peter at freepascal.org
Fri Jun 4 08:46:43 CEST 2004


> Hello,
>
> I've used the stuff following with fpc 1.0.10 and it worked fine, now
> with 1.9.2 the argument is set to zero:
>
> - a GTK+ 1.2 program)
> - a dialog has a pointer to a 'cdecl'ed callback procedure:
>
> <code>
> ...
> src := TCustomer(datasrc.Items[selCursor]);
> {$ifdef debug} writeln(src.asCSV); {$endif}
>
> { propagate selected entry }
> cbPropagate(src);
> ...
> </code>
>
> the debug output is okay, public string fields are filled. There the
> field 'Name' is accessed.
>
> This is where 'cbPropagate' goes to:
>
> <code>
> procedure setCustDataCallback(data: TCustomer); cdecl;
> begin
> 	writeln('Name is '+_data.Name);
> ...
> </code>
>
> when trying to write out the TCustomer field 'Name' declared as an
> AnsiString, the debugger tells me 'data' points to zero (0x0).
>
> Can someone please explain to me what's happening here?

Without a full (short) example we can't do anything.

> And why it worked fine on the 1.0.10 version of fpc?

1.9.2 uses register calling by default.






More information about the fpc-pascal mailing list