[fpc-pascal]External variables in FPC

Peter Vreman peter at freepascal.org
Thu Nov 23 17:41:25 CET 2000

> This is an update for all FPC developers using FPC under Linux.
> If you ever need to create FPC coded shared library  (XXX.SO) make use
> of variables which are also used by either a pascal or C application
> using the shared library,  make sure you provide a function to pass
> pointers to storage allocation to the library so that the library uses
> pointers to the variables while the application can access them
> directly.
I would even say: Don't create shared libraries yet, becuase FPC doesn't support PIC code.

> Avoid "EXTERNAL" and "CVAR" like the plague.
> The {$MODE} compiler switch causes all sorts of headaches when trying to
> create a shared library with exported
> variables in the shared library. Delphi mode does not allow for it, only
> FPC mode.  But most of the code is
> in delphi mode anyway.
That is your personal opinion. FPC mode is more restrictive and forces you to create much
cleaner code.

If you know how delphi allows to export variables will add support for it.

More information about the fpc-pascal mailing list