Subject: Porting Unix libraries to DLLs using gcc and commercial compilers
From: [email-masked]

3 May 1998 14:44:52 -0700
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 8bit
To: [email-masked]
Cc: [email-masked]

The following Dos batch file (AKA Unix script file) is adapted from
the Makefile.dll at http://www.cs.mu.oz.au/~fjh/gnu-win32.  It has
one very useful purpose:  It lets you generate .def files with 
exported functions for DLLs generated by commercial compilers like
Borland and MS, whose impdef programs only work for DLLs that were
generated using .def files that specified exported functions.  If
you've ever tried to port a Unix library to a Windows DLL, you
know exactly what I am talking about.

There is only one hitch so far.  You have to compile the Unix library
with gcc for the nm program to work.  So, to use a commercial compiler
to generate a real DLL library, you first need the gcc version so as
to automate the process of getting the exported functions and
variables list.

One of these days, I plan to add a few lines to makedef.bat so that
it lists imported functions as well.  If nm ever gets extended so
that it works for Borland and Microsoft DLL files, the gcc step
will be unnecessary.

======================================================================
makedef.bat (works under Dos, works under Unix):
======================================================================

echo EXPORTS > %1.def
nm %1.a > %1.tmp
sed -n "/^........ [BCDRT] _/s/[^_]*_//p" %1.tmp >> %1.def
erase %1.tmp
======================================================================
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".