[fpc-devel] Publishing symbol outside of "exports"

Anton Kavalenka anton.k at tut.by
Mon Nov 18 19:52:58 CET 2013


On 11.11.2013 21:53, Jonas Maebe wrote:
> On 11 Nov 2013, at 19:39, Anton Kavalenka wrote:
>
>> I'm playing with http://bugs.freepascal.org/view.php?id=17805
>>
>> I can include into .SO project the following unit.
>> It compiles but does not export symbol. Only export from module containing the word 'library' works.
> Yes, that's correct: http://bugs.freepascal.org/view.php?id=16070
>
>
> Jonas_______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
Btw -
exports directive in implementation section of unit works but only under 
win32.
Compiling the code under Linux with PIC does not export anything.

library a;
{$R *.res}
uses unita;
end.

unit unita;
interface
implementation
var pa:pointer;//external name 'FPC_RESLOCATION';
exports pa;
end.

$fpc -Cg a.pas
Free Pascal Compiler version 2.6.2-6 [2013/10/07] for x86_64
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling a.pas
Compiling unita.pas
Compiling resource a.or
Linking liba.so
/usr/bin/ld.bfd: warning: link.res contains output sections; did you 
forget -T?
16 lines compiled, 0.4 sec

$ nm liba.so
nm: liba.so: no symbols

Should I report this as separate bug?

regards,
Anton




More information about the fpc-devel mailing list