This is the mail archive of the cygwin mailing list for the Cygwin 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: DLL into .a

Paulo Mota wrote:

> Is there a tool to convert a DLL (which has no API Windows calls) into a
> lib.a or ?

That is not possible.  A DLL is fully linked code.  A static library
(libfoo.a) is unlinked code.  Linking is a one-way process, it removes
information that cannot be recovered.

A file named as is a libtool library, and is just a text file
of a few lines that describes the options relevant when linking with
that library.  It alone is useless, it is just metadata.

> If not, then say that I have a lib file named libmetis.a
> To make the executable I  would add the following
> "-L$HOME/<rest of the path> -lmetis"
> If I have WinMetis.dll, would there be an equivalent command?

Just add "WinMetis.dll" to the link command line like any other file to
be included in the link.

You can also create an import library, but that is not necessary unless
you need to do symbol aliasing or symbol renaming.  This is often
necessary when mixing libraries of different compilers due to
differences in stdcall name mangling, i.e. you need to remove the @nn

You might be confusing a static library with an import library, as they
both end in .a and have the same file format but they are totally
different things.  An import library (libfoo.dll.a, foo.lib, or
occasionally libfoo.a) does not contain any code, but rather just a list
of what the actual library (DLL) exports.  It is used by the linker when
linking to the DLL, but the GNU linker can also link directly to a DLL
without the need for an import library -- again as long as you don't
need to do any symbol renaming/aliasing.


Unsubscribe info:
Problem reports:

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