On 2011-12-11 22:57, ik wrote:
On Sun, Dec 11, 2011 at 23:35, Torsten Bonde Christiansen <t...@epidata.dk <mailto:t...@epidata.dk>> wrote:

    Hi.

    I'm trying to create a shared library (under linux) and I not sure
    what the
    difference between the modifier *export* and the section *exports*
    is? Or perhaps
    when to use one and the other...


export means that you can control the name of a symbol in how it will be in the elf file itself of the so. So you call your original procedure Foo, but you export it as 'baz', so using objdump in Linux, you'll find "baz" and not "Foo".

Exports, is the way to tell the compiler what are the symbols you wish to make available for reuse in the so file itself, so I could bind to them.
So in the following example "foo" would not be visible (neither as "foo" nor "bar") to other program (eg. a C-program) unless I added an *exports* section?

library test;

function foo(a: integer): integer; [export, alias: 'bar'];
begin
  result := a * a;
end;

end.


Basically what i'm trying to do, is use a lot of units and I want avoid creating a HUGE *exports* section but rather name the
methods in the units instead.

Regards,
Torsten Bonde Christiansen.


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to