Subject: How to build DLLs (Re: Minor bug and a question)
From: [email-masked] ("Valery Fine")

11 Feb 1997 12:36:30 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Comments: Authenticated sender is <[email-masked]>
Original-To: Chris Cowan <[email-masked]>
Original-CC: [email-masked]
X-mailer: Pegasus Mail for Windows (v2.23)
Original-Sender: [email-masked]

On 10 Feb 97 at 10:42

Chris Cowan wrote:

> Now the question:
> 
> I am wondering how one goes about listing the exported symbol table
> of a *.dll?   I tried using nm with no success.    Does Mircosoft
> ship a comparable utility to nm?
> 

  I've attached a code ( I hacked some times ago) to produce a Module 
Definition File (.DEF) for MS SDK from object (C/C++) files.
(see http://www.ifh.de/CHEP97/chep97.html 
Dynamic libraries: maintaining a single source for Unix &Windows
also).

  It works well but must be improved.

  This doesn't work with the global variables and constants. I wonder 
someone has a skill to make this thing up and complete it.

  This must be polished for the object files done with Fortran 
compiler too. (The separate story is a Fortran COMMON blocks. For those I
have no right solution at all yet).

  I believe this can be done as a separate  (FREE !!! ) utility. May 
be it needs a separate option to distniguish the brand of the object 
file: let's say from MS, Borland, gcc, Symantec, COFF  etc.

  Alas MS Linker doesn't understand IMPORTS so anyway to access the 
global pointers and keep a single source for both platforms as UNIX 
as WIN32 one has to change the source to access the global pointers 
indirectly (via Set/Get static function for example).

  There are other solutions.

  1. Jason Tishler <[email-masked]> adviced to use DUMPBIN output and 
     offered his script to do so.

    "I wrote a perl script that automatically generates the DLL 
     definition file needed to build a C++ DLL.  Perhaps it will meet 
     your needs or at least be a good starting point."

  2. Gunther Ebert <[email-masked]>

     gcc -c <source files>
     ar rc <tmplib> <compiled source files (.o)>
     ranlib <tmplib>
     echo EXPORTS > <.def file>
     nm <tmplib> | grep " [CT] " | sed '/ _/s// /' | awk '{print $3;}' >><.def file>

     This works fine for me.

   Hope this helps,

                    Valery

=================================================================
Dr. Valery Fine                  Telex : 911621 dubna su
    -----------
LCTA/Joint Inst.for NuclearRes   Phone : +7 09621 6 40 80
141980 Dubna, Moscow region      Fax   : +7 09621 6 51 45
Russia                           mailto:[email-masked]
                                 mailto:[email-masked]
Dr. Valeri Faine
    ------------                 Phone: +41 22 767 6468
CERN                             FAX  : +41 22 782 2601
CH-1211 Geneva, 23               mailto:[email-masked] 
Switzerland                      http://nicewww.cern.ch/~fine
                                 
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".