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 PhpWikiAdministration.

Preview: Page dump of CreateImportLibraries

(normal formatting: latest revision only)
Date: Wed, 7 Dec 2005 08:36:05 +0000
Mime-Version: 1.0 (Produced by PhpWiki 1.3.14)
Message-Id:
<1314-1133944565+0000-MinGW%3ACreateImportLibraries@oldwiki.mingw.org>
Content-Type: application/x-phpwiki;
  pagename=CreateImportLibraries;
  flags="";
  author=TechieTechie;
  owner=EarnieBoyd;
  version=5;
  lastmodified=1133944565;
  created=1133944565;
  author_id=TechieTechie;
  markup=2;
  summary=add%20help%20page%20about%20dlltool;
  hits=42514;
  charset=iso-8859-1
Content-Transfer-Encoding: binary

!!!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
you:<br>
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'
(without 's)<br>
  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
following lines:<br><br>
  LIBRARY SOMEDLL.DLL<br>
  EXPORT<br>
  <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>
<pre>
    dlltool -d somedll.def -l libsomedll.a
</pre>

Depending on the DLL you may want to try one or more of the
following:
* 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.

!!Some Examples
!def-file for an external lib created with Delphi
<pre>
LIBRARY Diverg01.dll
EXPORTS
Divergences
LTDivergences
STDivergences
</pre>

!Excerpt from a def-file for IBM's db2cli.dll
<pre>
LIBRARY DB2CLI.dll
EXPORTS
SQLAllocConnect@8
SQLAllocEnv@4
SQLAllocHandle@12
SQLAllocStmt@8
SQLBindCol@24
SQLBindFileToCol@32
SQLBindFileToParam@32
SQLBindParam@32
SQLBindParameter@40
SQLBrowseConnect@24
SQLBrowseConnectW@24
SQLBuildDataLink@40
SQLBulkOperations@8
...
</pre>
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:

TitleSearch:


See also: ViewSource?, PluginManager.

PHP Warning

lib/XmlElement.php:43 Warning[2]: get_class() expects parameter 1 to be object, string given (...repeated 10 times)

lib/XmlElement.php (In template 'navbar' < 'top' < 'body' < 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given:

lib/XmlElement.php (In template 'navbar' < 'top' < 'body' < 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given:

lib/XmlElement.php (In template 'browse' < 'body' < 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given

lib/XmlElement.php (In template 'body' < 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given

lib/XmlElement.php (In template 'body' < 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given

lib/XmlElement.php (In template 'body' < 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given

lib/XmlElement.php (In template 'body' < 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given

lib/XmlElement.php (In template 'body' < 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given

Valid XHTML 1.0! Valid CSS!
Page Execution took real: 0.136, user: 0.050, sys: 0.010 seconds , Memory: 2696272

lib/XmlElement.php (In template 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given

lib/XmlElement.php (In template 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given

lib/XmlElement.php (In template 'browse-footer'):43 Warning[2]: get_class() expects parameter 1 to be object, string given

lib/XmlElement.php (In template 'actionbar' < 'browse-footer'):43 Warning[2]: get_class() expects parameter 1 to be object, string given: