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               [--export-all-symbols] [--no-export-all-symbols]
15               [--exclude-symbols list]
16               [--no-default-excludes]
17               [-S|--as path-to-assembler] [-f|--as-flags options]
18               [-D|--dllname name] [-m|--machine machine]
19               [-a|--add-indirect]
20               [-U|--add-underscore] [--add-stdcall-underscore]
21               [-k|--kill-at] [-A|--add-stdcall-alias]
22               [-p|--ext-prefix-alias prefix]
23               [-x|--no-idata4] [-c|--no-idata5] [-i|--interwork]
24               [-n|--nodelete] [-t|--temp-prefix prefix]
25               [-v|--verbose]
26               [-h|--help] [-V|--version]
27               [object-file ...]
28

DESCRIPTION

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

OPTIONS

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

SEE ALSO

265       The Info pages for binutils.
266
268       Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
269       2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
270       Foundation, Inc.
271
272       Permission is granted to copy, distribute and/or modify this document
273       under the terms of the GNU Free Documentation License, Version 1.2 or
274       any later version published by the Free Software Foundation; with no
275       Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
276       Texts.  A copy of the license is included in the section entitled "GNU
277       Free Documentation License".
278
279
280
281binutils-2.19.50.0.1              2009-07-28                        DLLTOOL(1)
Impressum