This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Porting Unix libraries to DLLs using gcc and commercial compilers


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
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]