Mail Archives: cygwin/2008/03/18/06:57:10
Paulo Mota wrote:
> Is there a tool to convert a DLL (which has no API Windows calls) into a
> lib.a or lib.la ?
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 libfoo.la 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
decorations.
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.
Brian
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -