[fpc-devel] how to get same pthreads code to compile between Linux and FreeBSD

Graeme Geldenhuys graeme at geldenhuys.co.uk
Sun Feb 3 19:23:16 CET 2013


On 2013-02-03 18:08, Marco van de Voort wrote:
> 
> The resulting overloading can cause problems. It can be reduced by
> deprecating the original pascallized versions, and removing them in some
> future version.

So at this current point in time, my only solution is to have code as
follows in tiOPF:

 procedure TtiPool.CreatePoolSemaphore;
 ...
 begin
   {$ifdef windows}
    ...
   {$endif}
   {$ifdef unix}
     {$ifdef linux}
     ...
     {$endif}
     {$ifdef freebsd}
     ...
     {$endif}
     {$ifdef macosx}  // I plan to test under MacOSX soon
     ...
     {$endif}
   {$endif}
 end;

And everywhere else in the TtiPool class where sem_* methods are used.

This is just yuck!!! I hate IFDEF's. :-/


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/




More information about the fpc-devel mailing list