Standard preamble:
========================================================================
..
.... Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.
If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.
Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================
Title "DLLTOOL 1"
way too many mistakes in technical documents.
When creating a \s-1DLL,\s0 along with the source for the \s-1DLL,\s0 it is necessary to have three other files. dlltool can help with the creation of these files.
The first file is a .def file which specifies which functions are exported from the \s-1DLL,\s0 which functions the \s-1DLL\s0 imports, and so on. This is a text file and can be created by hand, or dlltool can be used to create it using the -z option. In this case dlltool will scan the object files specified on its command line looking for those functions which have been specially marked as being exported and put entries for them in the .def file it creates.
In order to mark a function as being exported from a \s-1DLL,\s0 it needs to have an -export:<name_of_function> entry in the .drectve section of the object file. This can be done in C by using the \fBasm() operator:
.Vb 2 asm (".section .drectve"); asm (".ascii \e"-export:my_func\e""); int my_func (void) { ... } .Ve
The second file needed for \s-1DLL\s0 creation is an exports file. This file is linked with the object files that make up the body of the \s-1DLL\s0 and it handles the interface between the \s-1DLL\s0 and the outside world. This is a binary file and it can be created by giving the -e option to \fBdlltool when it is creating or reading in a .def file.
The third file needed for \s-1DLL\s0 creation is the library file that programs will link with in order to access the functions in the \s-1DLL\s0 (an `import library'). This file can be created by giving the -l option to dlltool when it is creating or reading in a .def file.
If the -y option is specified, dlltool generates a delay-import library that can be used instead of the normal import library to allow a program to link to the dll only as soon as an imported function is called for the first time. The resulting executable will need to be linked to the static delayimp library containing _\|_delayLoadHelper2(), which in turn will import LoadLibraryA and GetProcAddress from kernel32.
\fBdlltool builds the library file by hand, but it builds the exports file by creating temporary files containing assembler statements and then assembling these. The -S command-line option can be used to specify the path to the assembler that dlltool will use, and the -f option can be used to pass specific flags to that assembler. The -n can be used to prevent dlltool from deleting these temporary assembler files when it is done, and if -n is specified twice then this will prevent dlltool from deleting the temporary object files it used to build the library.
Here is an example of creating a \s-1DLL\s0 from a source file dll.c and also creating a program (from an object file called program.o) that uses that \s-1DLL:\s0
.Vb 4 gcc -c dll.c dlltool -e exports.o -l dll.lib dll.o gcc dll.o exports.o -o dll.dll gcc program.o dll.lib -o program .Ve
\fBdlltool may also be used to query an existing import library to determine the name of the \s-1DLL\s0 to which it is associated. See the description of the -I or --identify option.
0
Specifies the name of a .def file to be read in and processed.
0
Specifies the name of a base file to be read in and processed. The contents of this file will be added to the relocation section in the exports file generated by dlltool.
0
Specifies the name of the export file to be created by dlltool.
0
Specifies the name of the .def file to be created by dlltool.
0
Specifies the name of the library file to be created by dlltool.
0
Specifies the name of the delay-import library file to be created by dlltool.
0
Specifies the path, including the filename, of the assembler to be used to create the exports file.
0
Specifies any specific command-line options to be passed to the assembler when building the exports file. This option will work even if the -S option is not used. This option only takes one argument, and if it occurs more than once on the command line, then later occurrences will override earlier occurrences. So if it is necessary to pass multiple options to the assembler they should be enclosed in double quotes.
0
Specifies the name to be stored in the .def file as the name of the \s-1DLL\s0 when the -e option is used. If this option is not present, then the filename given to the -e option will be used as the name of the \s-1DLL.\s0
0
Specifies the type of machine for which the library file should be built. dlltool has a built in default type, depending upon how it was created, but this option can be used to override that. This is normally only useful when creating DLLs for an \s-1ARM\s0 processor, when the contents of the \s-1DLL\s0 are actually encode using Thumb instructions.
0
Specifies that when dlltool is creating the exports file it should add a section which allows the exported functions to be referenced without using the import library. Whatever the hell that means!
0
Specifies that when dlltool is creating the exports file it should prepend an underscore to the names of all exported symbols.
0
Specifies whether standard symbol should be forced to be prefixed, or not.
0
Specifies that @<number> suffixes should be omitted from the names of stdcall functions that will be imported from the \s-1DLL.\s0 This is useful when creating an import library for a \s-1DLL\s0 which exports stdcall functions but without the usual @<number> symbol name suffix. .Sp This does not change the naming of symbols provided by the import library to programs linked against it, but only the entries in the import table (ie the .idata section).
0
Specifies that when dlltool is creating the exports file it should add aliases for stdcall symbols without @ <number> in addition to the symbols with @ <number>.
0
Causes dlltool to create external aliases for all \s-1DLL\s0 imports with the specified prefix. The aliases are created for both external and import symbols with no leading underscore.
0
Specifies that when dlltool is creating the exports and library files it should omit the \*(C`.idata4\*(C' section. This is for compatibility with certain operating systems.
0
Specifies that when dlltool is creating the exports and library files it should omit the \*(C`.idata5\*(C' section. This is for compatibility with certain operating systems.
0
Specifies that dlltool should inspect the import library indicated by filename and report, on \*(C`stdout\*(C', the name(s) of the associated \s-1DLL\s0(s). This can be performed in addition to any other operations indicated by the other options and arguments. \fBdlltool fails if the import library does not exist or is not actually an import library. See also --identify-strict.
0
Specifies that dlltool should mark the objects in the library file and exports file that it produces as supporting interworking between \s-1ARM\s0 and Thumb code.
0
Makes dlltool preserve the temporary assembler files it used to create the exports file. If this option is repeated then dlltool will also preserve the temporary object files it uses to create the library file.
0
Makes dlltool use prefix when constructing the names of temporary assembler and object files. By default, the temp file prefix is generated from the pid.
0
Make dlltool describe what it is doing.
0
Displays a list of command-line options and then exits.
0
Displays dlltool's version number and then exits.
Permission is granted to copy, distribute and/or modify this document under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".