[fpc-devel] Some details on BeginThread problem

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Sep 8 13:18:49 CEST 2006


On 8 sep 2006, at 06:07, Robert Reimiller wrote:

> Tool:0: libstrucs.pas:726: error: 36: Wrong number of parameters  
> specified
> Tool:0: libstrucs.pas:727: error: 36: Wrong number of parameters  
> specified
> Tool:0: libstrucs.pas:728: error: 25: Wrong number of parameters  
> specified
> Tool:0: libstrucs.pas:729: error: 48: Wrong number of parameters  
> specified
>
> The lines in question were:
>
>       threadid := beginthread(addr(libthread)) ;
>       threadid := beginthread(addr(libthread), q330) ;
>       BeginThread (addr(libthread), q330, threadid) ;
>       BeginThread (NIL, DefaultStackSize, addr(libthread), q330, 0,  
> threadid) ;
>
> The uses clause looks like: cthreads, baseunix, sockets, unix
>
> What am I doing wrong?

You are using the default FPC mode as opposed to Delphi or MacPas  
mode (which Xcode template are you using? They all set macpas mode by  
default). Therefore the compiler interprets your use of "libthread"  
as a function call, and expects parameters after it. Either compile  
with -Sd or add {$mode delphi} at the top of your program, or change  
"addr(libthread)" into "@libthread" (it's interesting that addr  
behaves differently from @ though, I didn't know that).


Jonas



More information about the fpc-devel mailing list