[fpc-pascal]Re-Summarize external variables problem
Peter Vreman
peter at freepascal.org
Thu Nov 23 10:06:11 CET 2000
> Please disregard all previous references to compiler problems of
> external variables.
>
> This is an FPC 1.0.2 problem under Linux.
>
> What I have noticed is that the ($MODE FPC} switch is global and cannot
> be toggled
> during the compilation of a given pascal unit.
>
> The compiler mode regulates whether the following line will compile
> properly:
>
> {$LINKLIB CMLB}
>
> Var
> test : integer ; cvar ; external ;
>
> This will not compile under DELPHI mode, but it will under FPC mode.
> (COMMAND LINE)
It won't compile either under Delphi, so it's refused in delphi mode.
>
> My workaround would be to use {$MODE} to switch ON the FPC mode and off
> immediately after the code
> for the external variable. What happens in fact is the compiler mode
> seems locked to either one mode or another
> for a given compile and cannot be changed on the fly.
>
> Thus, delphi mode compilations of a given unit fail while FPC mode
> compilations succeed. This appears to be a bug
> by not allowing a given compilation of units to compile under different
> modes.
>
> Some example code:
>
> Var
>
> {$MODE FPC} //Turn FPC compiler mode on
> test : integer ; cvar ; external ;
> {$MODE DEFAULT}//Restore original compiler mode
>
> {$MODE FPC} //Turn FPC compiler mode on
> test2 : integer ; external name 'test2' ; ///(NAMED VERSION)
> {$MODE DEFAULT}//Restore original compiler mode
That is not possible and will only leed to problems. Becuase the size of integer can
change per mode.
More information about the fpc-pascal
mailing list