delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/04/02/08:29:47

From: colin AT bird DOT fu DOT is DOT saga-u DOT ac DOT jp (Colin Peters)
Subject: RE: DLL to lib*.a?
2 Apr 1997 08:29:47 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <01BC3F6D.4E2712E0.cygnus.gnu-win32@gbird0>
Mime-Version: 1.0
Original-To: "gnu-win32 AT cygnus DOT com" <gnu-win32 AT cygnus DOT com>,
"'David W Palmer'"
<David_W_Palmer AT ccm DOT jf DOT intel DOT com>
Original-Sender: owner-gnu-win32 AT cygnus DOT com

David W Palmer[SMTP:David_W_Palmer AT ccm DOT jf DOT intel DOT 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 
>     libouch.a.
[snip]
>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:

EXPORTS
foo
bar

Good luck,

Colin.

-- Colin Peters - colin AT bird DOT fu DOT is DOT saga-u DOT ac DOT jp
-- Saga University Dept. of Information Science
-- http://www.fu.is.saga-u.ac.jp/~colin/index.html
-- http://www.geocities.com/Tokyo/Towers/6162/

-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019