Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2013-11

Publishing symbol outside of "exports"

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Anton Kavalenka

Dear FPC-All!

If there is possibility publishing .SO export symbol outside the main file exports section?

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.

unit reshdr;
{$mode objfpc}
interface
var rh : pointer; external name 'FPC_RESLOCATION';
implementation
exports
   rh;
end.

but FPC_RESLOCATION gets exported only when mentioned in main module export section.

regards,
Anton

Anton Kavalenka

Dear FPC-All!

If there is possibility of publishing .SO export symbol outside the main file exports section?

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.

unit reshdr;
{$mode objfpc}
interface
var rh : pointer; external name 'FPC_RESLOCATION';
implementation
exports
   rh;
end.

but FPC_RESLOCATION gets exported only when mentioned in main module export section.

regards,
Anton

Anton Kavalenka
to Jonas Maebe
Jonas Maebe wrote 12 lines
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 - 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