DLL to lib*.a?
Wed Apr 2 05:45:00 GMT 1997
David W Palmer[SMTP:David_W_Palmer@ccm.jf.intel.com] wrote:
> Has this made it to the FAQ yet? Try the following:
> dlltool --dllname ouch.dll --output-lib libouch.a
> Replace "ouch" with the DLL's base name for both ouch.dll and
>Is there any tool or something available to turn a DLL into a lib*.a?
>Or any other way to use functions in a DLL?
I'd like to point out that this solution doesn't actually work. What
the given command will do is indeed create a library libouch.a, but
that library will contain only the basic header information and no
actual function exports. The option --dllname simply instructs
dlltool what name to put into the library (which will be used by the
loader code to find the actual file, which is why, by the way, you
should never put a path in here, especially an absolute path).
To generate a library from a DLL you have to generate a .def file
containing a list of exports and then use
dlltool --def ouch.def --dllname ouch.dll --output-lib libouch.a
to generate the library. If the dll contains symbol information you
can use "nm | grep T" to get a list of function names which you can
use to make your .def file, or you can use Windows 95's "Quick View"
function to examine the exports of the DLL directly (more reliable,
since this will not include internal symbols like, for example,
__CTOR_LIST__ and such, and it works on files without symbols).
The def file can be simply the word "EXPORTS" followed by the names
of the functions to be exported, one per line, like this:
-- Colin Peters - email@example.com
-- Saga University Dept. of Information Science
For help on using this list, send a message to
"firstname.lastname@example.org" with one line of text: "help".
More information about the Cygwin