[fpc-devel]fpgtk problem

Peter Vreman peter at freepascal.org
Wed Apr 2 17:13:52 CEST 2003

>JP> I finally decided to make an attmept at compiling fpc from the CVS 
>JP> (fixes branch, 2003-04-01)
>JP> Everything went smooth, except for one small problem:
>JP>   fpgtk.pp(3032,57) Error: Illegal parameter list
>JP> The code in question is this:
>JP>   procedure TFPgtkObject.SignalEmit (aName:string; Args:array of const);
>JP>   begin
>JP>     gtk_signal_emit_by_name (TheGtkObject, pgchar(aName), Args);
>JP>   end;
>JP> Apparently the compiler is getting confused about exactly what
>JP> a "const" is, when Args is passed from a regular function to a
>JP> cdecl function.
>JP> At any rate, changing the declaration to this:
>JP>   procedure TFPgtkObject.SignalEmit (aName:string; Args:array of TVarRec);
>JP>  - seems to solve (or at least hide) the problem.
>Did you test also {$Mode Delphi}?

That will not solve the problem. The problem is that there is no knowledge 
how to push an array with X elements of a certain type to a C function. The 
compiler does not know anything at compile time and can't generate the 
correct code for it. Having a cdecl function with array of const has even 
less knowledge how much arguments are pushed since there is no length 
parameter at all.

Note that in C it is also not possible to call printf(format,...) with the 
arguments passed to function with variable arguments like trace_msg(format,...)


More information about the fpc-devel mailing list