version 3, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
DLLTOOL |
|
|
2 |
!!!DLLTOOL |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
OPTIONS |
|
|
7 |
SEE ALSO |
|
|
8 |
COPYRIGHT |
|
|
9 |
---- |
|
|
10 |
!!NAME |
|
|
11 |
|
|
|
12 |
|
|
|
13 |
dlltool - Create files needed to build and use DLLs. |
|
|
14 |
!!SYNOPSIS |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
dlltool [[__-d--input-def__ ''def-file-name''] |
|
|
18 |
[[__-b--base-file__ ''base-file-name''] |
|
|
19 |
[[__-e--output-exp__ ''exports-file-name''] |
|
|
20 |
[[__-z--output-def__ ''def-file-name''] |
|
|
21 |
[[__-l--output-lib__ ''library-file-name''] |
|
|
22 |
[[__--export-all-symbols__] |
|
|
23 |
[[__--no-export-all-symbols__] [[__--exclude-symbols__ |
|
|
24 |
''list''] [[__--no-default-excludes__] [[__-S--as__ |
|
|
25 |
''path-to-assembler''] [[__-f--as-flags__ |
|
|
26 |
''options''] [[__-D--dllname__ ''name''] |
|
|
27 |
[[__-m--machine__ ''machine''] |
|
|
28 |
[[__-a--add-indirect__] [[__-U--add-underscore__] |
|
|
29 |
[[__-k--kill-at__] [[__-A--add-stdcall-alias__] |
|
|
30 |
[[__-x--no-idata4__] [[__-c--no-idata5__] |
|
|
31 |
[[__-i--interwork__] [[__-n--nodelete__] |
|
|
32 |
[[__-v--verbose__] [[__-h--help__] [[__-V--version__] |
|
|
33 |
[[object-file ...] |
|
|
34 |
!!DESCRIPTION |
|
|
35 |
|
|
|
36 |
|
|
|
37 |
__dlltool__ reads its inputs, which can come from the |
|
|
38 |
__-d__ and __-b__ options as well as object files |
|
|
39 |
specified on the command line. It then processes these |
|
|
40 |
inputs and if the __-e__ option has been specified it |
|
|
41 |
creates a exports file. If the __-l__ option has been |
|
|
42 |
specified it creates a library file and if the __-z__ |
|
|
43 |
option has been specified it creates a def file. Any or all |
|
|
44 |
of the __-e__, __-l__ and __-z__ options can be |
|
|
45 |
present in one invocation of dlltool. |
|
|
46 |
|
|
|
47 |
|
|
|
48 |
When creating a DLL , along with the source |
|
|
49 |
for the DLL , it is necessary to have three |
|
|
50 |
other files. __dlltool__ can help with the creation of |
|
|
51 |
these files. |
|
|
52 |
|
|
|
53 |
|
|
|
54 |
The first file is a __.def__ file which specifies which |
|
|
55 |
functions are exported from the DLL , which |
|
|
56 |
functions the DLL imports, and so on. This is |
|
|
57 |
a text file and can be created by hand, or __dlltool__ |
|
|
58 |
can be used to create it using the __-z__ option. In this |
|
|
59 |
case __dlltool__ will scan the object files specified on |
|
|
60 |
its command line looking for those functions which have been |
|
|
61 |
specially marked as being exported and put entries for them |
|
|
62 |
in the .def file it creates. |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
In order to mark a function as being exported from a |
|
|
66 |
DLL , it needs to have an |
|
|
67 |
__-export:__ entry in the |
|
|
68 |
__.drectve__ section of the object file. This can be done |
|
|
69 |
in C by using the ''asm()'' operator: |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
asm ( |
|
|
73 |
int my_func (void) { ... } |
|
|
74 |
The second file needed for DLL creation is an exports file. This file is linked with the object files that make up the body of the DLL and it handles the interface between the DLL and the outside world. This is a binary file and it can be created by giving the __-e__ option to __dlltool__ when it is creating or reading in a .def file. |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
The third file needed for DLL creation is the |
|
|
78 |
library file that programs will link with in order to access |
|
|
79 |
the functions in the DLL . This file can be |
|
|
80 |
created by giving the __-l__ option to dlltool when it is |
|
|
81 |
creating or reading in a .def file. |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
__dlltool__ builds the library file by hand, but it |
|
|
85 |
builds the exports file by creating temporary files |
|
|
86 |
containing assembler statements and then assembling these. |
|
|
87 |
The __-S__ command line option can be used to specify the |
|
|
88 |
path to the assembler that dlltool will use, and the |
|
|
89 |
__-f__ option can be used to pass specific flags to that |
|
|
90 |
assembler. The __-n__ can be used to prevent dlltool from |
|
|
91 |
deleting these temporary assembler files when it is done, |
|
|
92 |
and if __-n__ is specified twice then this will prevent |
|
|
93 |
dlltool from deleting the temporary object files it used to |
|
|
94 |
build the library. |
|
|
95 |
|
|
|
96 |
|
|
|
97 |
Here is an example of creating a DLL from a |
|
|
98 |
source file __dll.c__ and also creating a program (from |
|
|
99 |
an object file called __program.o__) that uses that |
|
|
100 |
DLL: |
|
|
101 |
|
|
|
102 |
|
|
|
103 |
gcc -c dll.c |
|
|
104 |
dlltool -e exports.o -l dll.lib dll.o |
|
|
105 |
gcc dll.o exports.o -o dll.dll |
|
|
106 |
gcc program.o dll.lib -o program |
|
|
107 |
!!OPTIONS |
|
|
108 |
|
|
|
109 |
|
|
|
110 |
The command line options have the following |
|
|
111 |
meanings: |
|
|
112 |
|
|
|
113 |
|
|
|
114 |
__-d__ ''filename'' |
|
|
115 |
|
|
|
116 |
|
|
|
117 |
__--input-def__ ''filename'' |
|
|
118 |
|
|
|
119 |
|
|
|
120 |
Specifies the name of a .def file to be read in and |
|
|
121 |
processed. |
|
|
122 |
|
|
|
123 |
|
|
|
124 |
__-b__ ''filename'' |
|
|
125 |
|
|
|
126 |
|
|
|
127 |
__--base-file__ ''filename'' |
|
|
128 |
|
|
|
129 |
|
|
|
130 |
Specifies the name of a base file to be read in and |
|
|
131 |
processed. The contents of this file will be added to the |
|
|
132 |
relocation section in the exports file generated by |
|
|
133 |
dlltool. |
|
|
134 |
|
|
|
135 |
|
|
|
136 |
__-e__ ''filename'' |
|
|
137 |
|
|
|
138 |
|
|
|
139 |
__--output-exp__ ''filename'' |
|
|
140 |
|
|
|
141 |
|
|
|
142 |
Specifies the name of the export file to be created by |
|
|
143 |
dlltool. |
|
|
144 |
|
|
|
145 |
|
|
|
146 |
__-z__ ''filename'' |
|
|
147 |
|
|
|
148 |
|
|
|
149 |
__--output-def__ ''filename'' |
|
|
150 |
|
|
|
151 |
|
|
|
152 |
Specifies the name of the .def file to be created by |
|
|
153 |
dlltool. |
|
|
154 |
|
|
|
155 |
|
|
|
156 |
__-l__ ''filename'' |
|
|
157 |
|
|
|
158 |
|
|
|
159 |
__--output-lib__ ''filename'' |
|
|
160 |
|
|
|
161 |
|
|
|
162 |
Specifies the name of the library file to be created by |
|
|
163 |
dlltool. |
|
|
164 |
|
|
|
165 |
|
|
|
166 |
__--export-all-symbols__ |
|
|
167 |
|
|
|
168 |
|
|
|
169 |
Treat all global and weak defined symbols found in the input |
|
|
170 |
object files as symbols to be exported. There is a small |
|
|
171 |
list of symbols which are not exported by default; see the |
|
|
172 |
__--no-default-excludes__ option. You may add to the list |
|
|
173 |
of symbols to not export by using the |
|
|
174 |
__--exclude-symbols__ option. |
|
|
175 |
|
|
|
176 |
|
|
|
177 |
__--no-export-all-symbols__ |
|
|
178 |
|
|
|
179 |
|
|
|
180 |
Only export symbols explicitly listed in an input .def file |
|
|
181 |
or in __.drectve__ sections in the input object files. |
|
|
182 |
This is the default behaviour. The __.drectve__ sections |
|
|
183 |
are created by __dllexport__ attributes in the source |
|
|
184 |
code. |
|
|
185 |
|
|
|
186 |
|
|
|
187 |
__--exclude-symbols__ ''list'' |
|
|
188 |
|
|
|
189 |
|
|
|
190 |
Do not export the symbols in ''list''. This is a list of |
|
|
191 |
symbol names separated by comma or colon characters. The |
|
|
192 |
symbol names should not contain a leading underscore. This |
|
|
193 |
is only meaningful when __--export-all-symbols__ is |
|
|
194 |
used. |
|
|
195 |
|
|
|
196 |
|
|
|
197 |
__--no-default-excludes__ |
|
|
198 |
|
|
|
199 |
|
|
|
200 |
When __--export-all-symbols__ is used, it will by default |
|
|
201 |
avoid exporting certain special symbols. The current list of |
2 |
perry |
202 |
symbols to avoid exporting is __!DllMain@12__, |
|
|
203 |
__!DllEntryPoint@0__, __impure_ptr__. You may use the |
1 |
perry |
204 |
__--no-default-excludes__ option to go ahead and export |
|
|
205 |
these special symbols. This is only meaningful when |
|
|
206 |
__--export-all-symbols__ is used. |
|
|
207 |
|
|
|
208 |
|
|
|
209 |
__-S__ ''path'' |
|
|
210 |
|
|
|
211 |
|
|
|
212 |
__--as__ ''path'' |
|
|
213 |
|
|
|
214 |
|
|
|
215 |
Specifies the path, including the filename, of the assembler |
|
|
216 |
to be used to create the exports file. |
|
|
217 |
|
|
|
218 |
|
|
|
219 |
__-f__ ''options'' |
|
|
220 |
|
|
|
221 |
|
|
|
222 |
__--as-flags__ ''options'' |
|
|
223 |
|
|
|
224 |
|
|
|
225 |
Specifies any specific command line options to be passed to |
|
|
226 |
the assembler when building the exports file. This option |
|
|
227 |
will work even if the __-S__ option is not used. This |
|
|
228 |
option only takes one argument, and if it occurs more than |
|
|
229 |
once on the command line, then later occurrences will |
|
|
230 |
override earlier occurrences. So if it is necessary to pass |
|
|
231 |
multiple options to the assembler they should be enclosed in |
|
|
232 |
double quotes. |
|
|
233 |
|
|
|
234 |
|
|
|
235 |
__-D__ ''name'' |
|
|
236 |
|
|
|
237 |
|
|
|
238 |
__--dll-name__ ''name'' |
|
|
239 |
|
|
|
240 |
|
|
|
241 |
Specifies the name to be stored in the .def file as the name |
|
|
242 |
of the DLL when the __-e__ option is used. |
|
|
243 |
If this option is not present, then the filename given to |
|
|
244 |
the __-e__ option will be used as the name of the |
|
|
245 |
DLL . |
|
|
246 |
|
|
|
247 |
|
|
|
248 |
__-m__ ''machine'' |
|
|
249 |
|
|
|
250 |
|
|
|
251 |
__-machine__ ''machine'' |
|
|
252 |
|
|
|
253 |
|
|
|
254 |
Specifies the type of machine for which the library file |
|
|
255 |
should be built. __dlltool__ has a built in default type, |
|
|
256 |
depending upon how it was created, but this option can be |
|
|
257 |
used to override that. This is normally only useful when |
|
|
258 |
creating DLLs for an ARM processor, when the |
|
|
259 |
contents of the DLL are actually encode using |
|
|
260 |
Thumb instructions. |
|
|
261 |
|
|
|
262 |
|
|
|
263 |
__-a__ |
|
|
264 |
|
|
|
265 |
|
|
|
266 |
__--add-indirect__ |
|
|
267 |
|
|
|
268 |
|
|
|
269 |
Specifies that when __dlltool__ is creating the exports |
|
|
270 |
file it should add a section which allows the exported |
|
|
271 |
functions to be referenced without using the import library. |
|
|
272 |
Whatever the hell that means! |
|
|
273 |
|
|
|
274 |
|
|
|
275 |
__-U__ |
|
|
276 |
|
|
|
277 |
|
|
|
278 |
__--add-underscore__ |
|
|
279 |
|
|
|
280 |
|
|
|
281 |
Specifies that when __dlltool__ is creating the exports |
|
|
282 |
file it should prepend an underscore to the names of the |
3 |
CarloWood |
283 |
exported functions before actually calling them. |
1 |
perry |
284 |
|
|
|
285 |
|
|
|
286 |
__-k__ |
|
|
287 |
|
|
|
288 |
|
|
|
289 |
__--kill-at__ |
|
|
290 |
|
|
|
291 |
|
|
|
292 |
Specifies that when __dlltool__ is creating the exports |
3 |
CarloWood |
293 |
file it should remove the string `__@__<number>'. |
|
|
294 |
These numbers are part of the win32 __stdcall calling |
|
|
295 |
convention and represent the number of bytes the called |
|
|
296 |
function pops up from stack before returning. |
|
|
297 |
See [http://mywebpage.netscape.com/yongweiwu/stdcall.htm] |
|
|
298 |
for more details. |
1 |
perry |
299 |
|
|
|
300 |
__-A__ |
|
|
301 |
|
|
|
302 |
|
|
|
303 |
__--add-stdcall-alias__ |
|
|
304 |
|
|
|
305 |
|
|
|
306 |
Specifies that when __dlltool__ is creating the exports |
3 |
CarloWood |
307 |
file it should add alias symbols without `__@__<number>' |
|
|
308 |
in addition to the stdcall symbols with `__@__<number>'. |
1 |
perry |
309 |
|
|
|
310 |
|
|
|
311 |
__-x__ |
|
|
312 |
|
|
|
313 |
|
|
|
314 |
__--no-idata4__ |
|
|
315 |
|
|
|
316 |
|
|
|
317 |
Specifies that when __dlltool__ is creating the exports |
|
|
318 |
and library files it should omit the .idata4 |
|
|
319 |
section. This is for compatibility with certain operating |
|
|
320 |
systems. |
|
|
321 |
|
|
|
322 |
|
|
|
323 |
__-c__ |
|
|
324 |
|
|
|
325 |
|
|
|
326 |
__--no-idata5__ |
|
|
327 |
|
|
|
328 |
|
|
|
329 |
Specifies that when __dlltool__ is creating the exports |
|
|
330 |
and library files it should omit the .idata5 |
|
|
331 |
section. This is for compatibility with certain operating |
|
|
332 |
systems. |
|
|
333 |
|
|
|
334 |
|
|
|
335 |
__-i__ |
|
|
336 |
|
|
|
337 |
|
|
|
338 |
__--interwork__ |
|
|
339 |
|
|
|
340 |
|
|
|
341 |
Specifies that __dlltool__ should mark the objects in the |
|
|
342 |
library file and exports file that it produces as supporting |
|
|
343 |
interworking between ARM and Thumb |
|
|
344 |
code. |
|
|
345 |
|
|
|
346 |
|
|
|
347 |
__-n__ |
|
|
348 |
|
|
|
349 |
|
|
|
350 |
__--nodelete__ |
|
|
351 |
|
|
|
352 |
|
|
|
353 |
Makes __dlltool__ preserve the temporary assembler files |
|
|
354 |
it used to create the exports file. If this option is |
|
|
355 |
repeated then dlltool will also preserve the temporary |
|
|
356 |
object files it uses to create the library |
|
|
357 |
file. |
|
|
358 |
|
|
|
359 |
|
|
|
360 |
__-v__ |
|
|
361 |
|
|
|
362 |
|
|
|
363 |
__--verbose__ |
|
|
364 |
|
|
|
365 |
|
|
|
366 |
Make dlltool describe what it is doing. |
|
|
367 |
|
|
|
368 |
|
|
|
369 |
__-h__ |
|
|
370 |
|
|
|
371 |
|
|
|
372 |
__--help__ |
|
|
373 |
|
|
|
374 |
|
|
|
375 |
Displays a list of command line options and then |
|
|
376 |
exits. |
|
|
377 |
|
|
|
378 |
|
|
|
379 |
__-V__ |
|
|
380 |
|
|
|
381 |
|
|
|
382 |
__--version__ |
|
|
383 |
|
|
|
384 |
|
|
|
385 |
Displays dlltool's version number and then |
|
|
386 |
exits. |
|
|
387 |
!!SEE ALSO |
|
|
388 |
|
|
|
389 |
|
|
|
390 |
the Info entries for ''binutils''. |
|
|
391 |
!!COPYRIGHT |
|
|
392 |
|
|
|
393 |
|
|
|
394 |
Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, |
|
|
395 |
2001, 2002 Free Software Foundation, Inc. |
|
|
396 |
|
|
|
397 |
|
|
|
398 |
Permission is granted to copy, distribute and/or modify this |
|
|
399 |
document under the terms of the GNU Free |
|
|
400 |
Documentation License, Version 1.1 or any later version |
|
|
401 |
published by the Free Software Foundation; with no Invariant |
|
|
402 |
Sections, with no Front-Cover Texts, and with no Back-Cover |
|
|
403 |
Texts. A copy of the license is included in the section |
|
|
404 |
entitled `` GNU Free Documentation |
|
|
405 |
License''. |
|
|
406 |
---- |