Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / man / man1 / dlltool.1
blobc06ad5809215de7768c4383356bcffed435aa16f
1 .\" Automatically generated by Pod::Man version 1.15
2 .\" Thu Jan 19 19:57:57 2006
3 .\"
4 .\" Standard preamble:
5 .\" ======================================================================
6 .de Sh \" Subsection heading
7 .br
8 .if t .Sp
9 .ne 5
10 .PP
11 \fB\\$1\fR
12 .PP
14 .de Sp \" Vertical space (when we can't use .PP)
15 .if t .sp .5v
16 .if n .sp
18 .de Ip \" List item
19 .br
20 .ie \\n(.$>=3 .ne \\$3
21 .el .ne 3
22 .IP "\\$1" \\$2
24 .de Vb \" Begin verbatim text
25 .ft CW
26 .nf
27 .ne \\$1
29 .de Ve \" End verbatim text
30 .ft R
32 .fi
34 .\" Set up some character translations and predefined strings.  \*(-- will
35 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
36 .\" double quote, and \*(R" will give a right double quote.  | will give a
37 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used
38 .\" to do unbreakable dashes and therefore won't be available.  \*(C` and
39 .\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
40 .tr \(*W-|\(bv\*(Tr
41 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
42 .ie n \{\
43 .    ds -- \(*W-
44 .    ds PI pi
45 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
46 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
47 .    ds L" ""
48 .    ds R" ""
49 .    ds C` ""
50 .    ds C' ""
51 'br\}
52 .el\{\
53 .    ds -- \|\(em\|
54 .    ds PI \(*p
55 .    ds L" ``
56 .    ds R" ''
57 'br\}
58 .\"
59 .\" If the F register is turned on, we'll generate index entries on stderr
60 .\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
61 .\" index entries marked with X<> in POD.  Of course, you'll have to process
62 .\" the output yourself in some meaningful fashion.
63 .if \nF \{\
64 .    de IX
65 .    tm Index:\\$1\t\\n%\t"\\$2"
67 .    nr % 0
68 .    rr F
69 .\}
70 .\"
71 .\" For nroff, turn off justification.  Always turn off hyphenation; it
72 .\" makes way too many mistakes in technical documents.
73 .hy 0
74 .\"
75 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
76 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
77 .bd B 3
78 .    \" fudge factors for nroff and troff
79 .if n \{\
80 .    ds #H 0
81 .    ds #V .8m
82 .    ds #F .3m
83 .    ds #[ \f1
84 .    ds #] \fP
85 .\}
86 .if t \{\
87 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
88 .    ds #V .6m
89 .    ds #F 0
90 .    ds #[ \&
91 .    ds #] \&
92 .\}
93 .    \" simple accents for nroff and troff
94 .if n \{\
95 .    ds ' \&
96 .    ds ` \&
97 .    ds ^ \&
98 .    ds , \&
99 .    ds ~ ~
100 .    ds /
102 .if t \{\
103 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
104 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
105 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
106 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
107 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
108 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
110 .    \" troff and (daisy-wheel) nroff accents
111 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
112 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
113 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
114 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
115 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
116 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
117 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
118 .ds ae a\h'-(\w'a'u*4/10)'e
119 .ds Ae A\h'-(\w'A'u*4/10)'E
120 .    \" corrections for vroff
121 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
122 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
123 .    \" for low resolution devices (crt and lpr)
124 .if \n(.H>23 .if \n(.V>19 \
126 .    ds : e
127 .    ds 8 ss
128 .    ds o a
129 .    ds d- d\h'-1'\(ga
130 .    ds D- D\h'-1'\(hy
131 .    ds th \o'bp'
132 .    ds Th \o'LP'
133 .    ds ae ae
134 .    ds Ae AE
136 .rm #[ #] #H #V #F C
137 .\" ======================================================================
139 .IX Title "DLLTOOL 1"
140 .TH DLLTOOL 1 "binutils-2.16.91" "2006-01-19" "GNU Development Tools"
142 .SH "NAME"
143 dlltool \- Create files needed to build and use DLLs.
144 .SH "SYNOPSIS"
145 .IX Header "SYNOPSIS"
146 dlltool [\fB\-d\fR|\fB\*(--input-def\fR \fIdef-file-name\fR]
147         [\fB\-b\fR|\fB\*(--base-file\fR \fIbase-file-name\fR]
148         [\fB\-e\fR|\fB\*(--output-exp\fR \fIexports-file-name\fR]
149         [\fB\-z\fR|\fB\*(--output-def\fR \fIdef-file-name\fR]
150         [\fB\-l\fR|\fB\*(--output-lib\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] [\fB\-U\fR|\fB\*(--add-underscore\fR] [\fB\-k\fR|\fB\*(--kill-at\fR]
157         [\fB\-A\fR|\fB\*(--add-stdcall-alias\fR]
158         [\fB\-p\fR|\fB\*(--ext-prefix-alias\fR \fIprefix\fR]
159         [\fB\-x\fR|\fB\*(--no-idata4\fR] [\fB\-c\fR|\fB\*(--no-idata5\fR] [\fB\-i\fR|\fB\*(--interwork\fR]
160         [\fB\-n\fR|\fB\*(--nodelete\fR] [\fB\-t\fR|\fB\*(--temp-prefix\fR \fIprefix\fR]
161         [\fB\-v\fR|\fB\*(--verbose\fR] 
162         [\fB\-h\fR|\fB\*(--help\fR] [\fB\-V\fR|\fB\*(--version\fR]
163         [object-file ...]
164 .SH "DESCRIPTION"
165 .IX Header "DESCRIPTION"
166 \&\fBdlltool\fR reads its inputs, which can come from the \fB\-d\fR and
167 \&\fB\-b\fR options as well as object files specified on the command
168 line.  It then processes these inputs and if the \fB\-e\fR option has
169 been specified it creates a exports file.  If the \fB\-l\fR option
170 has been specified it creates a library file and if the \fB\-z\fR option
171 has been specified it creates a def file.  Any or all of the \fB\-e\fR, 
172 \&\fB\-l\fR and \fB\-z\fR options can be present in one invocation of 
173 dlltool.
175 When creating a \s-1DLL\s0, along with the source for the \s-1DLL\s0, it is necessary
176 to have three other files.  \fBdlltool\fR can help with the creation of
177 these files.
179 The first file is a \fI.def\fR file which specifies which functions are
180 exported from the \s-1DLL\s0, which functions the \s-1DLL\s0 imports, and so on.  This
181 is a text file and can be created by hand, or \fBdlltool\fR can be used
182 to create it using the \fB\-z\fR option.  In this case \fBdlltool\fR
183 will scan the object files specified on its command line looking for
184 those functions which have been specially marked as being exported and
185 put entries for them in the \fI.def\fR file it creates.
187 In order to mark a function as being exported from a \s-1DLL\s0, it needs to
188 have an \fB\-export:<name_of_function>\fR entry in the \fB.drectve\fR
189 section of the object file.  This can be done in C by using the
190 \&\fIasm()\fR operator:
192 .Vb 2
193 \&          asm (".section .drectve");  
194 \&          asm (".ascii \e"-export:my_func\e"");
196 .Vb 1
197 \&          int my_func (void) { ... }
199 The second file needed for \s-1DLL\s0 creation is an exports file.  This file
200 is linked with the object files that make up the body of the \s-1DLL\s0 and it
201 handles the interface between the \s-1DLL\s0 and the outside world.  This is a
202 binary file and it can be created by giving the \fB\-e\fR option to
203 \&\fBdlltool\fR when it is creating or reading in a \fI.def\fR file. 
205 The third file needed for \s-1DLL\s0 creation is the library file that programs
206 will link with in order to access the functions in the \s-1DLL\s0.  This file
207 can be created by giving the \fB\-l\fR option to dlltool when it
208 is creating or reading in a \fI.def\fR file.
210 \&\fBdlltool\fR builds the library file by hand, but it builds the
211 exports file by creating temporary files containing assembler statements
212 and then assembling these.  The \fB\-S\fR command line option can be
213 used to specify the path to the assembler that dlltool will use,
214 and the \fB\-f\fR option can be used to pass specific flags to that
215 assembler.  The \fB\-n\fR can be used to prevent dlltool from deleting
216 these temporary assembler files when it is done, and if \fB\-n\fR is
217 specified twice then this will prevent dlltool from deleting the
218 temporary object files it used to build the library.
220 Here is an example of creating a \s-1DLL\s0 from a source file \fBdll.c\fR and
221 also creating a program (from an object file called \fBprogram.o\fR)
222 that uses that \s-1DLL:\s0
224 .Vb 4
225 \&          gcc -c dll.c
226 \&          dlltool -e exports.o -l dll.lib dll.o
227 \&          gcc dll.o exports.o -o dll.dll
228 \&          gcc program.o dll.lib -o program
230 .SH "OPTIONS"
231 .IX Header "OPTIONS"
232 The command line options have the following meanings:
233 .Ip "\fB\-d\fR \fIfilename\fR" 4
234 .IX Item "-d filename"
235 .PD 0
236 .Ip "\fB\*(--input-def\fR \fIfilename\fR" 4
237 .IX Item "input-def filename"
239 Specifies the name of a \fI.def\fR file to be read in and processed.
240 .Ip "\fB\-b\fR \fIfilename\fR" 4
241 .IX Item "-b filename"
242 .PD 0
243 .Ip "\fB\*(--base-file\fR \fIfilename\fR" 4
244 .IX Item "base-file filename"
246 Specifies the name of a base file to be read in and processed.  The
247 contents of this file will be added to the relocation section in the
248 exports file generated by dlltool.
249 .Ip "\fB\-e\fR \fIfilename\fR" 4
250 .IX Item "-e filename"
251 .PD 0
252 .Ip "\fB\*(--output-exp\fR \fIfilename\fR" 4
253 .IX Item "output-exp filename"
255 Specifies the name of the export file to be created by dlltool.
256 .Ip "\fB\-z\fR \fIfilename\fR" 4
257 .IX Item "-z filename"
258 .PD 0
259 .Ip "\fB\*(--output-def\fR \fIfilename\fR" 4
260 .IX Item "output-def filename"
262 Specifies the name of the \fI.def\fR file to be created by dlltool.
263 .Ip "\fB\-l\fR \fIfilename\fR" 4
264 .IX Item "-l filename"
265 .PD 0
266 .Ip "\fB\*(--output-lib\fR \fIfilename\fR" 4
267 .IX Item "output-lib filename"
269 Specifies the name of the library file to be created by dlltool.
270 .Ip "\fB\*(--export-all-symbols\fR" 4
271 .IX Item "export-all-symbols"
272 Treat all global and weak defined symbols found in the input object
273 files as symbols to be exported.  There is a small list of symbols which
274 are not exported by default; see the \fB\*(--no-default-excludes\fR
275 option.  You may add to the list of symbols to not export by using the
276 \&\fB\*(--exclude-symbols\fR option.
277 .Ip "\fB\*(--no-export-all-symbols\fR" 4
278 .IX Item "no-export-all-symbols"
279 Only export symbols explicitly listed in an input \fI.def\fR file or in
280 \&\fB.drectve\fR sections in the input object files.  This is the default
281 behaviour.  The \fB.drectve\fR sections are created by \fBdllexport\fR
282 attributes in the source code.
283 .Ip "\fB\*(--exclude-symbols\fR \fIlist\fR" 4
284 .IX Item "exclude-symbols list"
285 Do not export the symbols in \fIlist\fR.  This is a list of symbol names
286 separated by comma or colon characters.  The symbol names should not
287 contain a leading underscore.  This is only meaningful when
288 \&\fB\*(--export-all-symbols\fR is used.
289 .Ip "\fB\*(--no-default-excludes\fR" 4
290 .IX Item "no-default-excludes"
291 When \fB\*(--export-all-symbols\fR is used, it will by default avoid
292 exporting certain special symbols.  The current list of symbols to avoid
293 exporting is \fBDllMain@12\fR, \fBDllEntryPoint@0\fR,
294 \&\fBimpure_ptr\fR.  You may use the \fB\*(--no-default-excludes\fR option
295 to go ahead and export these special symbols.  This is only meaningful
296 when \fB\*(--export-all-symbols\fR is used.
297 .Ip "\fB\-S\fR \fIpath\fR" 4
298 .IX Item "-S path"
299 .PD 0
300 .Ip "\fB\*(--as\fR \fIpath\fR" 4
301 .IX Item "as path"
303 Specifies the path, including the filename, of the assembler to be used
304 to create the exports file.
305 .Ip "\fB\-f\fR \fIoptions\fR" 4
306 .IX Item "-f options"
307 .PD 0
308 .Ip "\fB\*(--as-flags\fR \fIoptions\fR" 4
309 .IX Item "as-flags options"
311 Specifies any specific command line options to be passed to the
312 assembler when building the exports file.  This option will work even if
313 the \fB\-S\fR option is not used.  This option only takes one argument,
314 and if it occurs more than once on the command line, then later
315 occurrences will override earlier occurrences.  So if it is necessary to
316 pass multiple options to the assembler they should be enclosed in
317 double quotes.
318 .Ip "\fB\-D\fR \fIname\fR" 4
319 .IX Item "-D name"
320 .PD 0
321 .Ip "\fB\*(--dll-name\fR \fIname\fR" 4
322 .IX Item "dll-name name"
324 Specifies the name to be stored in the \fI.def\fR file as the name of
325 the \s-1DLL\s0 when the \fB\-e\fR option is used.  If this option is not
326 present, then the filename given to the \fB\-e\fR option will be
327 used as the name of the \s-1DLL\s0.
328 .Ip "\fB\-m\fR \fImachine\fR" 4
329 .IX Item "-m machine"
330 .PD 0
331 .Ip "\fB\-machine\fR \fImachine\fR" 4
332 .IX Item "-machine machine"
334 Specifies the type of machine for which the library file should be
335 built.  \fBdlltool\fR has a built in default type, depending upon how
336 it was created, but this option can be used to override that.  This is
337 normally only useful when creating DLLs for an \s-1ARM\s0 processor, when the
338 contents of the \s-1DLL\s0 are actually encode using Thumb instructions.
339 .Ip "\fB\-a\fR" 4
340 .IX Item "-a"
341 .PD 0
342 .Ip "\fB\*(--add-indirect\fR" 4
343 .IX Item "add-indirect"
345 Specifies that when \fBdlltool\fR is creating the exports file it
346 should add a section which allows the exported functions to be
347 referenced without using the import library.  Whatever the hell that
348 means! 
349 .Ip "\fB\-U\fR" 4
350 .IX Item "-U"
351 .PD 0
352 .Ip "\fB\*(--add-underscore\fR" 4
353 .IX Item "add-underscore"
355 Specifies that when \fBdlltool\fR is creating the exports file it
356 should prepend an underscore to the names of the exported functions. 
357 .Ip "\fB\-k\fR" 4
358 .IX Item "-k"
359 .PD 0
360 .Ip "\fB\*(--kill-at\fR" 4
361 .IX Item "kill-at"
363 Specifies that when \fBdlltool\fR is creating the exports file it
364 should not append the string \fB@ <number>\fR.  These numbers are
365 called ordinal numbers and they represent another way of accessing the
366 function in a \s-1DLL\s0, other than by name.
367 .Ip "\fB\-A\fR" 4
368 .IX Item "-A"
369 .PD 0
370 .Ip "\fB\*(--add-stdcall-alias\fR" 4
371 .IX Item "add-stdcall-alias"
373 Specifies that when \fBdlltool\fR is creating the exports file it
374 should add aliases for stdcall symbols without \fB@ <number>\fR
375 in addition to the symbols with \fB@ <number>\fR.
376 .Ip "\fB\-p\fR" 4
377 .IX Item "-p"
378 .PD 0
379 .Ip "\fB\*(--ext-prefix-alias\fR \fIprefix\fR" 4
380 .IX Item "ext-prefix-alias prefix"
382 Causes \fBdlltool\fR to create external aliases for all \s-1DLL\s0
383 imports with the specified prefix.  The aliases are created for both
384 external and import symbols with no leading underscore.
385 .Ip "\fB\-x\fR" 4
386 .IX Item "-x"
387 .PD 0
388 .Ip "\fB\*(--no-idata4\fR" 4
389 .IX Item "no-idata4"
391 Specifies that when \fBdlltool\fR is creating the exports and library
392 files it should omit the \f(CW\*(C`.idata4\*(C'\fR section.  This is for compatibility
393 with certain operating systems.
394 .Ip "\fB\-c\fR" 4
395 .IX Item "-c"
396 .PD 0
397 .Ip "\fB\*(--no-idata5\fR" 4
398 .IX Item "no-idata5"
400 Specifies that when \fBdlltool\fR is creating the exports and library
401 files it should omit the \f(CW\*(C`.idata5\*(C'\fR section.  This is for compatibility
402 with certain operating systems.
403 .Ip "\fB\-i\fR" 4
404 .IX Item "-i"
405 .PD 0
406 .Ip "\fB\*(--interwork\fR" 4
407 .IX Item "interwork"
409 Specifies that \fBdlltool\fR should mark the objects in the library
410 file and exports file that it produces as supporting interworking
411 between \s-1ARM\s0 and Thumb code.
412 .Ip "\fB\-n\fR" 4
413 .IX Item "-n"
414 .PD 0
415 .Ip "\fB\*(--nodelete\fR" 4
416 .IX Item "nodelete"
418 Makes \fBdlltool\fR preserve the temporary assembler files it used to
419 create the exports file.  If this option is repeated then dlltool will
420 also preserve the temporary object files it uses to create the library
421 file.
422 .Ip "\fB\-t\fR \fIprefix\fR" 4
423 .IX Item "-t prefix"
424 .PD 0
425 .Ip "\fB\*(--temp-prefix\fR \fIprefix\fR" 4
426 .IX Item "temp-prefix prefix"
428 Makes \fBdlltool\fR use \fIprefix\fR when constructing the names of
429 temporary assembler and object files.  By default, the temp file prefix
430 is generated from the pid.  
431 .Ip "\fB\-v\fR" 4
432 .IX Item "-v"
433 .PD 0
434 .Ip "\fB\*(--verbose\fR" 4
435 .IX Item "verbose"
437 Make dlltool describe what it is doing.
438 .Ip "\fB\-h\fR" 4
439 .IX Item "-h"
440 .PD 0
441 .Ip "\fB\*(--help\fR" 4
442 .IX Item "help"
444 Displays a list of command line options and then exits.
445 .Ip "\fB\-V\fR" 4
446 .IX Item "-V"
447 .PD 0
448 .Ip "\fB\*(--version\fR" 4
449 .IX Item "version"
451 Displays dlltool's version number and then exits.
452 .Ip "\fB@\fR\fIfile\fR" 4
453 .IX Item "@file"
454 Read command-line options from \fIfile\fR.  The options read are
455 inserted in place of the original @\fIfile\fR option.  If \fIfile\fR
456 does not exist, or cannot be read, then the option will be treated
457 literally, and not removed.  
459 Options in \fIfile\fR are separated by whitespace.  A whitespace
460 character may be included in an option by surrounding the entire
461 option in either single or double quotes.  Any character (including a
462 backslash) may be included by prefixing the character to be included
463 with a backslash.  The \fIfile\fR may itself contain additional
464 @\fIfile\fR options; any such options will be processed recursively.
465 .SH "SEE ALSO"
466 .IX Header "SEE ALSO"
467 The Info pages for \fIbinutils\fR.
468 .SH "COPYRIGHT"
469 .IX Header "COPYRIGHT"
470 Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
471 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
473 Permission is granted to copy, distribute and/or modify this document
474 under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1
475 or any later version published by the Free Software Foundation;
476 with no Invariant Sections, with no Front-Cover Texts, and with no
477 Back-Cover Texts.  A copy of the license is included in the
478 section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".