[fpc-pascal] Re: WinCE / Win32 compilation

Sven Barth pascaldragon at googlemail.com
Sat Oct 16 13:12:34 CEST 2010


On 16.10.2010 12:35, Uffe Kousgaard wrote:
> "Jonas Maebe"<jonas.maebe at elis.ugent.be>  wrote in
> message news:6EF537CB-D266-4034-8C96-8286158AC7A9 at elis.ugent.be...
>
>> 1) Whenever I compile "single = min(single,single)" I have to add math.min
>> or the win32 compiler complains and expects longints instead. Is there a
>> difference between the RTL in the two versions?
>
>> Compile with -vh to see which declaration the compiler finds when the
>> compilation fails.
>
> Max(LongInt,LongInt): LongInt
>
>> TCriticalSection is not a class, it's a Win API struct.
>
> It is a class in D7, SyncObjs.pas. And understood by the WinCE compiler, at
> least it seems so.
>
> Even if it just maps to the WinAPI, it is still a class.

TCriticalSection is a WinAPI struct if you include the unit Windows.
If you include the unit SyncObjs it's a Object Pascal class that uses 
FPC's cross platform TRTLCriticalSection.

The problem is if you include both units it depends on the order of the 
unit which type wins.

E.g.

uses
   Windows, SyncObjs;

var
   cs: TCriticalSection; // will be SyncObjs.TCriticalSection (a class)

but

uses
   SyncObjs, Windows;

var
   cs: TCriticalSection; // will be Windows.TCriticalSection (a record)

This is the same in Delphi by the way.

Regards,
Sven



More information about the fpc-pascal mailing list