[fpc-devel] Some details on BeginThread problem

Robert Reimiller certgrps at certsoft.com
Fri Sep 8 06:07:31 CEST 2006


The actual thread function starts out as :

function libthread (p : pointer) : longint ;
var
   q330 : pq330 ;
   readfds, writefds, exceptfds : tFdSet;
   timeout : timeval ;
   res : integer ;
   now_, diff : double ;
   new_ten_sec : longint ;
begin
   q330 := p ;

The compiler seems to reject any number of parameters to BeginThread. The  
errors
generated were:

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?






More information about the fpc-devel mailing list