[fpc-pascal]Re-Summarize external variables problem

md md at realmwireless.com
Thu Nov 23 06:56:09 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)

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


It spits a compiler error about: Syntax error, : expected but ; found.

or for the named version of the declaration

It spits a compiler error about: Syntax error, : expected but NAME
found.

Any help appreciated,

Mark Diener




More information about the fpc-pascal mailing list