View a wiki page in MIME format or download it as backup of a single
page. A complete dump of all pages can be produced in
(normal formatting: latest revision only)
Date: Wed, 7 Dec 2005 08:36:05 +0000
Mime-Version: 1.0 (Produced by PhpWiki 1.3.14)
!!!Minimalist GNU for Windows
!!Create Import Libraries
Usually (read: for all DLLs created with MinGW and also a few others)
MinGW links fine against a DLL. However there are situations when it
won't. Then one needs a so-called import library to help the linker.
The rest of this page gives hints as to how to create such import
libraries when there is only the DLL available.
MinGW comes with a handy tool which does most of the work for
dlltool.exe (or i586-mingw32-dlltool or something similar). Issue
'dlltool --help' to get a brief description of the available options.
Sometimes [dlltool] can create an import library from the DLL. But
then you wouldn't need an import library since the linker wouldn't
need one. So you probably are reading this because you've got a DLL
against which MinGW can't link without further help. You will provide
this help by creating a def-File. There are several ways to create
such a file. In the following some of these will be described:
* issue 'dlltool -z somedll.def --export-all-symbol somedll.dll'
chances are high that you'll get something like 'dlltool:
somedll.dll: no symbols'. Otherwise the resulting def-File is a good
startingpoint and probably will need only little additional tweaking.
* use your favorite texteditor and create a file somedll.def with the
<list of external names, one per line><br><br>
Here <list of external names> is at least the list of unsatisfied
external references the linker did complain about and that are
supposed to be in somedll.dll. The list is given one name per line.
Once you've created the def-File (see above) you'll issue<br>
dlltool -d somedll.def -l libsomedll.a
Depending on the DLL you may want to try one or more of the
* add option -U<br>This will prefix all symbols in the import library
with an underscore '_'
* add option -k<br>This removes @<n> from the exported names but their
calling convention remains stdcall.
* add option -A<br>This adds an alias for all stdcall entries but
without the @<n>, i.e. you get both the undecorated names (as with -k)
and the decorated names.
For a detailed description of these options and dlltool take a look at
the corresponding documentation.
That's it. The resulting file libsomedll.a should satisfy the linker.
!def-file for an external lib created with Delphi
!Excerpt from a def-file for IBM's db2cli.dll
Preview as developer format
| Preview as backup format
Warning: Please use one of the downloadable versions rather than copying and pasting from the above preview. The wordwrap of the preview doesn't take nested markup or list indentation into consideration! PhpWiki developers should manually inspect the downloaded file for nested markup before rewrapping with emacs and checking into CVS.
Download for backup
| Download all revisions for backup
| Download for CVS
Enter exact page name to dump:
See also: ViewSource?, PluginManager.