1 .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
9 .de Vb \" Begin verbatim text
14 .de Ve \" End verbatim text
18 .\" Set up some character translations and predefined strings. \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote. \*(C+ will
21 .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
29 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
49 .\" If the F register is >0, we'll generate index entries on stderr for
50 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51 .\" entries marked with X<> in POD. Of course, you'll have to process the
52 .\" output yourself in some meaningful fashion.
54 .\" Avoid warning from groff about undefined register 'F'.
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{\
62 . tm Index:\\$1\t\\n%\t"\\$2"
72 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
73 .\" Fear. Run. Save yourself. No user-serviceable parts.
74 . \" fudge factors for nroff and troff
83 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
89 . \" simple accents for nroff and troff
99 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
100 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
101 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
102 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
103 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
104 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
106 . \" troff and (daisy-wheel) nroff accents
107 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
108 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
109 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
110 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
111 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
112 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
113 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
114 .ds ae a\h'-(\w'a'u*4/10)'e
115 .ds Ae A\h'-(\w'A'u*4/10)'E
116 . \" corrections for vroff
117 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
118 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
119 . \" for low resolution devices (crt and lpr)
120 .if \n(.H>23 .if \n(.V>19 \
133 .\" ========================================================================
135 .IX Title "DLLTOOL 1"
136 .TH DLLTOOL 1 "2022-02-09" "binutils-2.38" "GNU Development Tools"
137 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
138 .\" way too many mistakes in technical documents.
142 dlltool \- create files needed to build and use DLLs
144 .IX Header "SYNOPSIS"
145 dlltool [\fB\-d\fR|\fB\-\-input\-def\fR \fIdef-file-name\fR]
146 [\fB\-b\fR|\fB\-\-base\-file\fR \fIbase-file-name\fR]
147 [\fB\-e\fR|\fB\-\-output\-exp\fR \fIexports-file-name\fR]
148 [\fB\-z\fR|\fB\-\-output\-def\fR \fIdef-file-name\fR]
149 [\fB\-l\fR|\fB\-\-output\-lib\fR \fIlibrary-file-name\fR]
150 [\fB\-y\fR|\fB\-\-output\-delaylib\fR \fIlibrary-file-name\fR]
151 [\fB\-\-export\-all\-symbols\fR] [\fB\-\-no\-export\-all\-symbols\fR]
152 [\fB\-\-exclude\-symbols\fR \fIlist\fR]
153 [\fB\-\-no\-default\-excludes\fR]
154 [\fB\-S\fR|\fB\-\-as\fR \fIpath-to-assembler\fR] [\fB\-f\fR|\fB\-\-as\-flags\fR \fIoptions\fR]
155 [\fB\-D\fR|\fB\-\-dllname\fR \fIname\fR] [\fB\-m\fR|\fB\-\-machine\fR \fImachine\fR]
156 [\fB\-a\fR|\fB\-\-add\-indirect\fR]
157 [\fB\-U\fR|\fB\-\-add\-underscore\fR] [\fB\-\-add\-stdcall\-underscore\fR]
158 [\fB\-k\fR|\fB\-\-kill\-at\fR] [\fB\-A\fR|\fB\-\-add\-stdcall\-alias\fR]
159 [\fB\-p\fR|\fB\-\-ext\-prefix\-alias\fR \fIprefix\fR]
160 [\fB\-x\fR|\fB\-\-no\-idata4\fR] [\fB\-c\fR|\fB\-\-no\-idata5\fR]
161 [\fB\-\-use\-nul\-prefixed\-import\-tables\fR]
162 [\fB\-I\fR|\fB\-\-identify\fR \fIlibrary-file-name\fR] [\fB\-\-identify\-strict\fR]
163 [\fB\-i\fR|\fB\-\-interwork\fR]
164 [\fB\-n\fR|\fB\-\-nodelete\fR] [\fB\-t\fR|\fB\-\-temp\-prefix\fR \fIprefix\fR]
165 [\fB\-v\fR|\fB\-\-verbose\fR]
166 [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR]
167 [\fB\-\-no\-leading\-underscore\fR] [\fB\-\-leading\-underscore\fR]
170 .IX Header "DESCRIPTION"
171 \&\fBdlltool\fR reads its inputs, which can come from the \fB\-d\fR and
172 \&\fB\-b\fR options as well as object files specified on the command
173 line. It then processes these inputs and if the \fB\-e\fR option has
174 been specified it creates a exports file. If the \fB\-l\fR option
175 has been specified it creates a library file and if the \fB\-z\fR option
176 has been specified it creates a def file. Any or all of the \fB\-e\fR,
177 \&\fB\-l\fR and \fB\-z\fR options can be present in one invocation of
180 When creating a \s-1DLL,\s0 along with the source for the \s-1DLL,\s0 it is necessary
181 to have three other files. \fBdlltool\fR can help with the creation of
184 The first file is a \fI.def\fR file which specifies which functions are
185 exported from the \s-1DLL,\s0 which functions the \s-1DLL\s0 imports, and so on. This
186 is a text file and can be created by hand, or \fBdlltool\fR can be used
187 to create it using the \fB\-z\fR option. In this case \fBdlltool\fR
188 will scan the object files specified on its command line looking for
189 those functions which have been specially marked as being exported and
190 put entries for them in the \fI.def\fR file it creates.
192 In order to mark a function as being exported from a \s-1DLL,\s0 it needs to
193 have an \fB\-export:<name_of_function>\fR entry in the \fB.drectve\fR
194 section of the object file. This can be done in C by using the
195 \&\fBasm()\fR operator:
198 \& asm (".section .drectve");
199 \& asm (".ascii \e"\-export:my_func\e"");
201 \& int my_func (void) { ... }
204 The second file needed for \s-1DLL\s0 creation is an exports file. This file
205 is linked with the object files that make up the body of the \s-1DLL\s0 and it
206 handles the interface between the \s-1DLL\s0 and the outside world. This is a
207 binary file and it can be created by giving the \fB\-e\fR option to
208 \&\fBdlltool\fR when it is creating or reading in a \fI.def\fR file.
210 The third file needed for \s-1DLL\s0 creation is the library file that programs
211 will link with in order to access the functions in the \s-1DLL\s0 (an `import
212 library'). This file can be created by giving the \fB\-l\fR option to
213 dlltool when it is creating or reading in a \fI.def\fR file.
215 If the \fB\-y\fR option is specified, dlltool generates a delay-import
216 library that can be used instead of the normal import library to allow
217 a program to link to the dll only as soon as an imported function is
218 called for the first time. The resulting executable will need to be
219 linked to the static delayimp library containing _\|\fB_delayLoadHelper2()\fR,
220 which in turn will import LoadLibraryA and GetProcAddress from kernel32.
222 \&\fBdlltool\fR builds the library file by hand, but it builds the
223 exports file by creating temporary files containing assembler statements
224 and then assembling these. The \fB\-S\fR command-line option can be
225 used to specify the path to the assembler that dlltool will use,
226 and the \fB\-f\fR option can be used to pass specific flags to that
227 assembler. The \fB\-n\fR can be used to prevent dlltool from deleting
228 these temporary assembler files when it is done, and if \fB\-n\fR is
229 specified twice then this will prevent dlltool from deleting the
230 temporary object files it used to build the library.
232 Here is an example of creating a \s-1DLL\s0 from a source file \fBdll.c\fR and
233 also creating a program (from an object file called \fBprogram.o\fR)
234 that uses that \s-1DLL:\s0
238 \& dlltool \-e exports.o \-l dll.lib dll.o
239 \& gcc dll.o exports.o \-o dll.dll
240 \& gcc program.o dll.lib \-o program
243 \&\fBdlltool\fR may also be used to query an existing import library
244 to determine the name of the \s-1DLL\s0 to which it is associated. See the
245 description of the \fB\-I\fR or \fB\-\-identify\fR option.
248 The command-line options have the following meanings:
249 .IP "\fB\-d\fR \fIfilename\fR" 4
250 .IX Item "-d filename"
252 .IP "\fB\-\-input\-def\fR \fIfilename\fR" 4
253 .IX Item "--input-def filename"
255 Specifies the name of a \fI.def\fR file to be read in and processed.
256 .IP "\fB\-b\fR \fIfilename\fR" 4
257 .IX Item "-b filename"
259 .IP "\fB\-\-base\-file\fR \fIfilename\fR" 4
260 .IX Item "--base-file filename"
262 Specifies the name of a base file to be read in and processed. The
263 contents of this file will be added to the relocation section in the
264 exports file generated by dlltool.
265 .IP "\fB\-e\fR \fIfilename\fR" 4
266 .IX Item "-e filename"
268 .IP "\fB\-\-output\-exp\fR \fIfilename\fR" 4
269 .IX Item "--output-exp filename"
271 Specifies the name of the export file to be created by dlltool.
272 .IP "\fB\-z\fR \fIfilename\fR" 4
273 .IX Item "-z filename"
275 .IP "\fB\-\-output\-def\fR \fIfilename\fR" 4
276 .IX Item "--output-def filename"
278 Specifies the name of the \fI.def\fR file to be created by dlltool.
279 .IP "\fB\-l\fR \fIfilename\fR" 4
280 .IX Item "-l filename"
282 .IP "\fB\-\-output\-lib\fR \fIfilename\fR" 4
283 .IX Item "--output-lib filename"
285 Specifies the name of the library file to be created by dlltool.
286 .IP "\fB\-y\fR \fIfilename\fR" 4
287 .IX Item "-y filename"
289 .IP "\fB\-\-output\-delaylib\fR \fIfilename\fR" 4
290 .IX Item "--output-delaylib filename"
292 Specifies the name of the delay-import library file to be created by dlltool.
293 .IP "\fB\-\-export\-all\-symbols\fR" 4
294 .IX Item "--export-all-symbols"
295 Treat all global and weak defined symbols found in the input object
296 files as symbols to be exported. There is a small list of symbols which
297 are not exported by default; see the \fB\-\-no\-default\-excludes\fR
298 option. You may add to the list of symbols to not export by using the
299 \&\fB\-\-exclude\-symbols\fR option.
300 .IP "\fB\-\-no\-export\-all\-symbols\fR" 4
301 .IX Item "--no-export-all-symbols"
302 Only export symbols explicitly listed in an input \fI.def\fR file or in
303 \&\fB.drectve\fR sections in the input object files. This is the default
304 behaviour. The \fB.drectve\fR sections are created by \fBdllexport\fR
305 attributes in the source code.
306 .IP "\fB\-\-exclude\-symbols\fR \fIlist\fR" 4
307 .IX Item "--exclude-symbols list"
308 Do not export the symbols in \fIlist\fR. This is a list of symbol names
309 separated by comma or colon characters. The symbol names should not
310 contain a leading underscore. This is only meaningful when
311 \&\fB\-\-export\-all\-symbols\fR is used.
312 .IP "\fB\-\-no\-default\-excludes\fR" 4
313 .IX Item "--no-default-excludes"
314 When \fB\-\-export\-all\-symbols\fR is used, it will by default avoid
315 exporting certain special symbols. The current list of symbols to avoid
316 exporting is \fBDllMain@12\fR, \fBDllEntryPoint@0\fR,
317 \&\fBimpure_ptr\fR. You may use the \fB\-\-no\-default\-excludes\fR option
318 to go ahead and export these special symbols. This is only meaningful
319 when \fB\-\-export\-all\-symbols\fR is used.
320 .IP "\fB\-S\fR \fIpath\fR" 4
323 .IP "\fB\-\-as\fR \fIpath\fR" 4
326 Specifies the path, including the filename, of the assembler to be used
327 to create the exports file.
328 .IP "\fB\-f\fR \fIoptions\fR" 4
329 .IX Item "-f options"
331 .IP "\fB\-\-as\-flags\fR \fIoptions\fR" 4
332 .IX Item "--as-flags options"
334 Specifies any specific command-line options to be passed to the
335 assembler when building the exports file. This option will work even if
336 the \fB\-S\fR option is not used. This option only takes one argument,
337 and if it occurs more than once on the command line, then later
338 occurrences will override earlier occurrences. So if it is necessary to
339 pass multiple options to the assembler they should be enclosed in
341 .IP "\fB\-D\fR \fIname\fR" 4
344 .IP "\fB\-\-dll\-name\fR \fIname\fR" 4
345 .IX Item "--dll-name name"
347 Specifies the name to be stored in the \fI.def\fR file as the name of
348 the \s-1DLL\s0 when the \fB\-e\fR option is used. If this option is not
349 present, then the filename given to the \fB\-e\fR option will be
350 used as the name of the \s-1DLL.\s0
351 .IP "\fB\-m\fR \fImachine\fR" 4
352 .IX Item "-m machine"
354 .IP "\fB\-machine\fR \fImachine\fR" 4
355 .IX Item "-machine machine"
357 Specifies the type of machine for which the library file should be
358 built. \fBdlltool\fR has a built in default type, depending upon how
359 it was created, but this option can be used to override that. This is
360 normally only useful when creating DLLs for an \s-1ARM\s0 processor, when the
361 contents of the \s-1DLL\s0 are actually encode using Thumb instructions.
365 .IP "\fB\-\-add\-indirect\fR" 4
366 .IX Item "--add-indirect"
368 Specifies that when \fBdlltool\fR is creating the exports file it
369 should add a section which allows the exported functions to be
370 referenced without using the import library. Whatever the hell that
375 .IP "\fB\-\-add\-underscore\fR" 4
376 .IX Item "--add-underscore"
378 Specifies that when \fBdlltool\fR is creating the exports file it
379 should prepend an underscore to the names of \fIall\fR exported symbols.
380 .IP "\fB\-\-no\-leading\-underscore\fR" 4
381 .IX Item "--no-leading-underscore"
383 .IP "\fB\-\-leading\-underscore\fR" 4
384 .IX Item "--leading-underscore"
386 Specifies whether standard symbol should be forced to be prefixed, or
388 .IP "\fB\-\-add\-stdcall\-underscore\fR" 4
389 .IX Item "--add-stdcall-underscore"
390 Specifies that when \fBdlltool\fR is creating the exports file it
391 should prepend an underscore to the names of exported \fIstdcall\fR
392 functions. Variable names and non-stdcall function names are not modified.
393 This option is useful when creating GNU-compatible import libs for third
394 party DLLs that were built with MS-Windows tools.
398 .IP "\fB\-\-kill\-at\fR" 4
401 Specifies that \fB@<number>\fR suffixes should be omitted from the names
402 of stdcall functions that will be imported from the \s-1DLL.\s0 This is
403 useful when creating an import library for a \s-1DLL\s0 which exports stdcall
404 functions but without the usual \fB@<number>\fR symbol name suffix.
406 This does not change the naming of symbols provided by the import library
407 to programs linked against it, but only the entries in the import table
408 (ie the .idata section).
412 .IP "\fB\-\-add\-stdcall\-alias\fR" 4
413 .IX Item "--add-stdcall-alias"
415 Specifies that when \fBdlltool\fR is creating the exports file it
416 should add aliases for stdcall symbols without \fB@ <number>\fR
417 in addition to the symbols with \fB@ <number>\fR.
421 .IP "\fB\-\-ext\-prefix\-alias\fR \fIprefix\fR" 4
422 .IX Item "--ext-prefix-alias prefix"
424 Causes \fBdlltool\fR to create external aliases for all \s-1DLL\s0
425 imports with the specified prefix. The aliases are created for both
426 external and import symbols with no leading underscore.
430 .IP "\fB\-\-no\-idata4\fR" 4
431 .IX Item "--no-idata4"
433 Specifies that when \fBdlltool\fR is creating the exports and library
434 files it should omit the \f(CW\*(C`.idata4\*(C'\fR section. This is for compatibility
435 with certain operating systems.
436 .IP "\fB\-\-use\-nul\-prefixed\-import\-tables\fR" 4
437 .IX Item "--use-nul-prefixed-import-tables"
438 Specifies that when \fBdlltool\fR is creating the exports and library
439 files it should prefix the \f(CW\*(C`.idata4\*(C'\fR and \f(CW\*(C`.idata5\*(C'\fR by zero an
440 element. This emulates old gnu import library generation of
441 \&\f(CW\*(C`dlltool\*(C'\fR. By default this option is turned off.
445 .IP "\fB\-\-no\-idata5\fR" 4
446 .IX Item "--no-idata5"
448 Specifies that when \fBdlltool\fR is creating the exports and library
449 files it should omit the \f(CW\*(C`.idata5\*(C'\fR section. This is for compatibility
450 with certain operating systems.
451 .IP "\fB\-I\fR \fIfilename\fR" 4
452 .IX Item "-I filename"
454 .IP "\fB\-\-identify\fR \fIfilename\fR" 4
455 .IX Item "--identify filename"
457 Specifies that \fBdlltool\fR should inspect the import library
458 indicated by \fIfilename\fR and report, on \f(CW\*(C`stdout\*(C'\fR, the name(s)
459 of the associated \s-1DLL\s0(s). This can be performed in addition to any
460 other operations indicated by the other options and arguments.
461 \&\fBdlltool\fR fails if the import library does not exist or is not
462 actually an import library. See also \fB\-\-identify\-strict\fR.
463 .IP "\fB\-\-identify\-strict\fR" 4
464 .IX Item "--identify-strict"
465 Modifies the behavior of the \fB\-\-identify\fR option, such
466 that an error is reported if \fIfilename\fR is associated with
467 more than one \s-1DLL.\s0
471 .IP "\fB\-\-interwork\fR" 4
472 .IX Item "--interwork"
474 Specifies that \fBdlltool\fR should mark the objects in the library
475 file and exports file that it produces as supporting interworking
476 between \s-1ARM\s0 and Thumb code.
480 .IP "\fB\-\-nodelete\fR" 4
481 .IX Item "--nodelete"
483 Makes \fBdlltool\fR preserve the temporary assembler files it used to
484 create the exports file. If this option is repeated then dlltool will
485 also preserve the temporary object files it uses to create the library
487 .IP "\fB\-t\fR \fIprefix\fR" 4
490 .IP "\fB\-\-temp\-prefix\fR \fIprefix\fR" 4
491 .IX Item "--temp-prefix prefix"
493 Makes \fBdlltool\fR use \fIprefix\fR when constructing the names of
494 temporary assembler and object files. By default, the temp file prefix
495 is generated from the pid.
499 .IP "\fB\-\-verbose\fR" 4
502 Make dlltool describe what it is doing.
506 .IP "\fB\-\-help\fR" 4
509 Displays a list of command-line options and then exits.
513 .IP "\fB\-\-version\fR" 4
516 Displays dlltool's version number and then exits.
517 .IP "\fB@\fR\fIfile\fR" 4
519 Read command-line options from \fIfile\fR. The options read are
520 inserted in place of the original @\fIfile\fR option. If \fIfile\fR
521 does not exist, or cannot be read, then the option will be treated
522 literally, and not removed.
524 Options in \fIfile\fR are separated by whitespace. A whitespace
525 character may be included in an option by surrounding the entire
526 option in either single or double quotes. Any character (including a
527 backslash) may be included by prefixing the character to be included
528 with a backslash. The \fIfile\fR may itself contain additional
529 @\fIfile\fR options; any such options will be processed recursively.
531 .IX Header "SEE ALSO"
532 The Info pages for \fIbinutils\fR.
534 .IX Header "COPYRIGHT"
535 Copyright (c) 1991\-2022 Free Software Foundation, Inc.
537 Permission is granted to copy, distribute and/or modify this document
538 under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3
539 or any later version published by the Free Software Foundation;
540 with no Invariant Sections, with no Front-Cover Texts, and with no
541 Back-Cover Texts. A copy of the license is included in the
542 section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".