This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ld and export lists


Nick,

Thanks. One more question this also works fi .sl right? I know WIN32 has a completely different concept for shared libraries then Unix.

Thanks,
Robert

Nick Clifton wrote:

Hi Robert,


How does one define an export list for a shared library using
ld.

By using a DEF file.

Have a look at the information in the ld.texinfo file for more details
about this. (You should get a copy of the latest version from the CVS
repository, since this section has seen a lot of work in the last few
months). In particular in the WIN32 section of the Machine Dependent
Features section it says this:

_exporting DLL symbols_
The cygwin/mingw `ld' has several ways to export symbols for dll's.

_using auto-export functionality_
By default `ld' exports symbols with the auto-export
functionality, which is controlled by the following command
line options:

--export-all-symbols [This is the default]
--exclude-symbols
--exclude-libs

_using a DEF file_
Another way of exporting symbols is using a DEF file. A DEF
file is an ASCII file containing definitions of symbols which
should be exported when a dll is created. Usually it is
named `<dll name>.def' and is added as any other object file
to the linker's command line.

gcc -o <output> <objectfiles> <dll name>.def

Here is an example of a DEF file for a shared library called
`xyz.dll':

LIBRARY "xyz.dll" BASE=0x10000000
EXPORTS
foo
bar
_bar = bar

This example defines a base address and three symbols. The
third symbol is an alias for the second. For the complete
format specification see ld/deffilep.y in the binutils
sources.

While linking a shared dll, `ld' is able to create a DEF file
with the `--output-def <file>' command line option.

Cheers
Nick




--
Robert Schweikert                   MAY THE SOURCE BE WITH YOU
rjschwei@cox.net                               LINUX




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]