From: vtailor AT gte DOT net Subject: Porting Unix libraries to DLLs using gcc and commercial compilers 3 May 1998 14:44:52 -0700 Message-ID: <199805031629.LAA00597.cygnus.gnu-win32@smtp1.mailsrvcs.net> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit To: gnu-win32 AT cygnus DOT com Cc: vtailor AT gte DOT net 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 AT cygnus DOT com" with one line of text: "help".