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

Sven Barth pascaldragon at googlemail.com
Sun Feb 3 19:29:57 CET 2013


On 03.02.2013 19:23, Graeme Geldenhuys wrote:
> 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.

Why? The variant with the TYPEDADDRESS should work for the other *nix 
targets as well...

Regards,
Sven




More information about the fpc-devel mailing list