[fpc-devel]Exporting variables in libraries for Linux / FreeBSD

Peter Vreman peter at freepascal.org
Sat Feb 15 08:24:38 CET 2003

At 21:09 14-2-2003, you wrote:
>hey Anton,
> > In Free Pascal Programmer's Manual, 7. 2., I didn't find anything about
> > restrictions for exporting variables. Where did you read that? And what
> > of library (static, shared, ..) is it?
>It's very simple.
>Try compiling this:
>library test;
>var o: integer;
>   o;
>it will compile on Win32, but just refuse to compile on Linux. When you
>search on the error the compiler generates, you'll find the docs that
>explain that exporting of variables is only supported on Win32.

Under linux it is not supported because linux works different with shared 
libraries. For procedures we could add an extra jmp with the new name. But 
for variables it's not possible as for the imported variables it is not 
know if they need an extra derefence (that is what WIn32 is using for dll 
variables) or that they need to be imported bij the dynamic linker.


More information about the fpc-devel mailing list