Reputation: 61
In Windows, an executable called dlltool
, given with GCC, is used to generate import library for a DLL file which is used for linking DLL files.
For example, libmylibrary.a
for mylibrary.dll
. But in Linux (i.e., Ubuntu) I haven't find any equivalent program like this. In gcc
(both Windows and Linux), the -l
options is used to link these import libraries.
So, is there such an application in Linux that can generate an import library for shared object (.so files)?
Upvotes: 2
Views: 2306
Reputation: 61
There are even easier way to do this. There is something called linker scripts, which is a text file similiar to .def
file. Just write linker script on a text file, rename extension from .txt
to .a
and add lib
before its name and then pass it as argument with -l
command of the compiler or linker.
An example of linker script is given below
OUTPUT_FORMAT(elf32_i386)
INPUT(/usr/lib/i386-linux-gnu/libssl3.so /usr/lib/i386-linux-gnu/libao.so.4)
Upvotes: 0
Reputation: 798716
ld
(part of binutils
, and invoked by gcc
during the link phase) on Linux does not require import libraries; it is capable of reading .so files directly for the symbols required for linking.
Upvotes: 3