1DLLTOOL(1)                   GNU Development Tools                  DLLTOOL(1)
2
3
4

NAME

6       dlltool - Create files needed to build and use DLLs.
7

SYNOPSIS

9       dlltool [-d|--input-def def-file-name]
10               [-b|--base-file base-file-name]
11               [-e|--output-exp exports-file-name]
12               [-z|--output-def def-file-name]
13               [-l|--output-lib library-file-name]
14               [-y|--output-delaylib library-file-name]
15               [--export-all-symbols] [--no-export-all-symbols]
16               [--exclude-symbols list]
17               [--no-default-excludes]
18               [-S|--as path-to-assembler] [-f|--as-flags options]
19               [-D|--dllname name] [-m|--machine machine]
20               [-a|--add-indirect]
21               [-U|--add-underscore] [--add-stdcall-underscore]
22               [-k|--kill-at] [-A|--add-stdcall-alias]
23               [-p|--ext-prefix-alias prefix]
24               [-x|--no-idata4] [-c|--no-idata5]
25               [--use-nul-prefixed-import-tables]
26               [-I|--identify library-file-name] [--identify-strict]
27               [-i|--interwork]
28               [-n|--nodelete] [-t|--temp-prefix prefix]
29               [-v|--verbose]
30               [-h|--help] [-V|--version]
31               [object-file ...]
32

DESCRIPTION

34       dlltool reads its inputs, which can come from the -d and -b options as
35       well as object files specified on the command line.  It then processes
36       these inputs and if the -e option has been specified it creates a
37       exports file.  If the -l option has been specified it creates a library
38       file and if the -z option has been specified it creates a def file.
39       Any or all of the -e, -l and -z options can be present in one
40       invocation of dlltool.
41
42       When creating a DLL, along with the source for the DLL, it is necessary
43       to have three other files.  dlltool can help with the creation of these
44       files.
45
46       The first file is a .def file which specifies which functions are
47       exported from the DLL, which functions the DLL imports, and so on.
48       This is a text file and can be created by hand, or dlltool can be used
49       to create it using the -z option.  In this case dlltool will scan the
50       object files specified on its command line looking for those functions
51       which have been specially marked as being exported and put entries for
52       them in the .def file it creates.
53
54       In order to mark a function as being exported from a DLL, it needs to
55       have an -export:<name_of_function> entry in the .drectve section of the
56       object file.  This can be done in C by using the asm() operator:
57
58                 asm (".section .drectve");
59                 asm (".ascii \"-export:my_func\"");
60
61                 int my_func (void) { ... }
62
63       The second file needed for DLL creation is an exports file.  This file
64       is linked with the object files that make up the body of the DLL and it
65       handles the interface between the DLL and the outside world.  This is a
66       binary file and it can be created by giving the -e option to dlltool
67       when it is creating or reading in a .def file.
68
69       The third file needed for DLL creation is the library file that
70       programs will link with in order to access the functions in the DLL (an
71       `import library').  This file can be created by giving the -l option to
72       dlltool when it is creating or reading in a .def file.
73
74       If the -y option is specified, dlltool generates a delay-import library
75       that can be used instead of the normal import library to allow a
76       program to link to the dll only as soon as an imported function is
77       called for the first time. The resulting executable will need to be
78       linked to the static delayimp library containing __delayLoadHelper2(),
79       which in turn will import LoadLibraryA and GetProcAddress from
80       kernel32.
81
82       dlltool builds the library file by hand, but it builds the exports file
83       by creating temporary files containing assembler statements and then
84       assembling these.  The -S command line option can be used to specify
85       the path to the assembler that dlltool will use, and the -f option can
86       be used to pass specific flags to that assembler.  The -n can be used
87       to prevent dlltool from deleting these temporary assembler files when
88       it is done, and if -n is specified twice then this will prevent dlltool
89       from deleting the temporary object files it used to build the library.
90
91       Here is an example of creating a DLL from a source file dll.c and also
92       creating a program (from an object file called program.o) that uses
93       that DLL:
94
95                 gcc -c dll.c
96                 dlltool -e exports.o -l dll.lib dll.o
97                 gcc dll.o exports.o -o dll.dll
98                 gcc program.o dll.lib -o program
99
100       dlltool may also be used to query an existing import library to
101       determine the name of the DLL to which it is associated.  See the
102       description of the -I or --identify option.
103

OPTIONS

105       The command line options have the following meanings:
106
107       -d filename
108       --input-def filename
109           Specifies the name of a .def file to be read in and processed.
110
111       -b filename
112       --base-file filename
113           Specifies the name of a base file to be read in and processed.  The
114           contents of this file will be added to the relocation section in
115           the exports file generated by dlltool.
116
117       -e filename
118       --output-exp filename
119           Specifies the name of the export file to be created by dlltool.
120
121       -z filename
122       --output-def filename
123           Specifies the name of the .def file to be created by dlltool.
124
125       -l filename
126       --output-lib filename
127           Specifies the name of the library file to be created by dlltool.
128
129       -y filename
130       --output-delaylib filename
131           Specifies the name of the delay-import library file to be created
132           by dlltool.
133
134       --export-all-symbols
135           Treat all global and weak defined symbols found in the input object
136           files as symbols to be exported.  There is a small list of symbols
137           which are not exported by default; see the --no-default-excludes
138           option.  You may add to the list of symbols to not export by using
139           the --exclude-symbols option.
140
141       --no-export-all-symbols
142           Only export symbols explicitly listed in an input .def file or in
143           .drectve sections in the input object files.  This is the default
144           behaviour.  The .drectve sections are created by dllexport
145           attributes in the source code.
146
147       --exclude-symbols list
148           Do not export the symbols in list.  This is a list of symbol names
149           separated by comma or colon characters.  The symbol names should
150           not contain a leading underscore.  This is only meaningful when
151           --export-all-symbols is used.
152
153       --no-default-excludes
154           When --export-all-symbols is used, it will by default avoid
155           exporting certain special symbols.  The current list of symbols to
156           avoid exporting is DllMain@12, DllEntryPoint@0, impure_ptr.  You
157           may use the --no-default-excludes option to go ahead and export
158           these special symbols.  This is only meaningful when
159           --export-all-symbols is used.
160
161       -S path
162       --as path
163           Specifies the path, including the filename, of the assembler to be
164           used to create the exports file.
165
166       -f options
167       --as-flags options
168           Specifies any specific command line options to be passed to the
169           assembler when building the exports file.  This option will work
170           even if the -S option is not used.  This option only takes one
171           argument, and if it occurs more than once on the command line, then
172           later occurrences will override earlier occurrences.  So if it is
173           necessary to pass multiple options to the assembler they should be
174           enclosed in double quotes.
175
176       -D name
177       --dll-name name
178           Specifies the name to be stored in the .def file as the name of the
179           DLL when the -e option is used.  If this option is not present,
180           then the filename given to the -e option will be used as the name
181           of the DLL.
182
183       -m machine
184       -machine machine
185           Specifies the type of machine for which the library file should be
186           built.  dlltool has a built in default type, depending upon how it
187           was created, but this option can be used to override that.  This is
188           normally only useful when creating DLLs for an ARM processor, when
189           the contents of the DLL are actually encode using Thumb
190           instructions.
191
192       -a
193       --add-indirect
194           Specifies that when dlltool is creating the exports file it should
195           add a section which allows the exported functions to be referenced
196           without using the import library.  Whatever the hell that means!
197
198       -U
199       --add-underscore
200           Specifies that when dlltool is creating the exports file it should
201           prepend an underscore to the names of all exported symbols.
202
203       --add-stdcall-underscore
204           Specifies that when dlltool is creating the exports file it should
205           prepend an underscore to the names of exported stdcall functions.
206           Variable names and non-stdcall function names are not modified.
207           This option is useful when creating GNU-compatible import libs for
208           third party DLLs that were built with MS-Windows tools.
209
210       -k
211       --kill-at
212           Specifies that when dlltool is creating the exports file it should
213           not append the string @ <number>.  These numbers are called ordinal
214           numbers and they represent another way of accessing the function in
215           a DLL, other than by name.
216
217       -A
218       --add-stdcall-alias
219           Specifies that when dlltool is creating the exports file it should
220           add aliases for stdcall symbols without @ <number> in addition to
221           the symbols with @ <number>.
222
223       -p
224       --ext-prefix-alias prefix
225           Causes dlltool to create external aliases for all DLL imports with
226           the specified prefix.  The aliases are created for both external
227           and import symbols with no leading underscore.
228
229       -x
230       --no-idata4
231           Specifies that when dlltool is creating the exports and library
232           files it should omit the ".idata4" section.  This is for
233           compatibility with certain operating systems.
234
235       --use-nul-prefixed-import-tables
236           Specifies that when dlltool is creating the exports and library
237           files it should prefix the ".idata4" and ".idata5" by zero an
238           element. This emulates old gnu import library generation of
239           "dlltool". By default this option is turned off.
240
241       -c
242       --no-idata5
243           Specifies that when dlltool is creating the exports and library
244           files it should omit the ".idata5" section.  This is for
245           compatibility with certain operating systems.
246
247       -I filename
248       --identify filename
249           Specifies that dlltool should inspect the import library indicated
250           by filename and report, on "stdout", the name(s) of the associated
251           DLL(s).  This can be performed in addition to any other operations
252           indicated by the other options and arguments.  dlltool fails if the
253           import library does not exist or is not actually an import library.
254           See also --identify-strict.
255
256       --identify-strict
257           Modifies the behavior of the --identify option, such that an error
258           is reported if filename is associated with more than one DLL.
259
260       -i
261       --interwork
262           Specifies that dlltool should mark the objects in the library file
263           and exports file that it produces as supporting interworking
264           between ARM and Thumb code.
265
266       -n
267       --nodelete
268           Makes dlltool preserve the temporary assembler files it used to
269           create the exports file.  If this option is repeated then dlltool
270           will also preserve the temporary object files it uses to create the
271           library file.
272
273       -t prefix
274       --temp-prefix prefix
275           Makes dlltool use prefix when constructing the names of temporary
276           assembler and object files.  By default, the temp file prefix is
277           generated from the pid.
278
279       -v
280       --verbose
281           Make dlltool describe what it is doing.
282
283       -h
284       --help
285           Displays a list of command line options and then exits.
286
287       -V
288       --version
289           Displays dlltool's version number and then exits.
290
291       @file
292           Read command-line options from file.  The options read are inserted
293           in place of the original @file option.  If file does not exist, or
294           cannot be read, then the option will be treated literally, and not
295           removed.
296
297           Options in file are separated by whitespace.  A whitespace
298           character may be included in an option by surrounding the entire
299           option in either single or double quotes.  Any character (including
300           a backslash) may be included by prefixing the character to be
301           included with a backslash.  The file may itself contain additional
302           @file options; any such options will be processed recursively.
303

SEE ALSO

305       The Info pages for binutils.
306
308       Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
309       2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
310       Software Foundation, Inc.
311
312       Permission is granted to copy, distribute and/or modify this document
313       under the terms of the GNU Free Documentation License, Version 1.3 or
314       any later version published by the Free Software Foundation; with no
315       Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
316       Texts.  A copy of the license is included in the section entitled "GNU
317       Free Documentation License".
318
319
320
321binutils-2.20                     2009-10-16                        DLLTOOL(1)
Impressum