DLLTOOL(1)
π NAME π
okay so bestie, meet dlltool(1) β the GNU Development Tools icon whose whole job is creating files needed to build and use DLLs. no cap, that's literally the name and the mission. β¨
πΈ SYNOPSIS πΈ
here's the whole command shape, and yes it's giving "options buffet" energy:
dlltool [-d|--input-def def-file-name]
[-b|--base-file base-file-name]
[-e|--output-exp exports-file-name]
[-z|--output-def def-file-name]
[-l|--output-lib library-file-name]
[-y|--output-delaylib library-file-name]
[--export-all-symbols] [--no-export-all-symbols]
[--exclude-symbols list]
[--no-default-excludes]
[-S|--as path-to-assembler] [-f|--as-flags options]
[-D|--dllname name] [-m|--machine machine]
[-a|--add-indirect]
[-U|--add-underscore] [--add-stdcall-underscore]
[-k|--kill-at] [-A|--add-stdcall-alias]
[-p|--ext-prefix-alias prefix]
[-x|--no-idata4] [-c|--no-idata5]
[--use-nul-prefixed-import-tables]
[-I|--identify library-file-name] [--identify-strict]
[-i|--interwork]
[-n|--nodelete] [-t|--temp-prefix prefix]
[-v|--verbose]
[-h|--help] [-V|--version]
[--no-leading-underscore] [--leading-underscore]
[--deterministic-libraries] [--non-deterministic-libraries]
[object-file ...]
π¦ DESCRIPTION π¦
okay so dlltool reads its inputs, which can come from the -d and -b options as well as object files specified on the command line. then it processes these inputs, and if the -e option has been specified it creates an exports file. if the -l option has been specified it creates a library file, and if the -z option has been specified it creates a def file. any or all of the -e, -l and -z options can be present in one invocation of dlltool. slay, multitasking icon behavior. π
when creating a DLL, along with the source for the DLL, it is necessary to have three other files. dlltool can help with the creation of these files. obsessed, honestly.
the first file is a .def file which specifies which functions are exported from the DLL, which functions the DLL 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. main character scanning energy, fr fr.
in order to mark a function as being exported from a DLL, 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 asm() operator:
asm (".section .drectve");
asm (".ascii \"-export:my_func\"");
int my_func (void) { ... }
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. binary file bestie, not for casual reading. π
the third file needed for DLL creation is the library file that programs will link with in order to access the functions in the DLL (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. iconic third-file behavior, no notes. π
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. iykyk, that's the delay-import lore. β
dlltool 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. temporary files stay or go, bestie's choice. β¨
here is an example of creating a DLL from a source file dll.c and also creating a program (from an object file called program.o) that uses that DLL:
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
dlltool may also be used to query an existing import library to determine the name of the DLL to which it is associated. see the description of the -I or --identify option. query mode era, okay? π
β¨ OPTIONS β¨
So like, here's what all the command-line options actually mean, bestie π
-d filename,--input-def filenameβ tells it which.deffile to read in and process. That's the input, the vibes going in β¨-b filename,--base-file filenameβ names a base file to read in and process. Whatever's inside gets added to the relocation section in the exports file thatdlltoolmakes. π«Ά-e filename,--output-exp filenameβ the name of the export file to be created. Output goals π-z filename,--output-def filenameβ the name of the.deffile to be created.-l filename,--output-lib filenameβ the name of the library file to be created.-y filename,--output-delaylib filenameβ the name of the delay-import library file to be created. Fancy β¨--deterministic-libraries,--non-deterministic-librariesβ when you're making output libraries via either--output-libor--output-delaylib, this picks whether it uses a value of zero for any timestamps, user ids and group ids it creates (--deterministic-libraries) or the actual timestamps, user ids and group ids (--non-deterministic-libraries). Reproducible build girlies, this one's for you π--export-all-symbolsβ treat every global and weak defined symbol found in the input object files as a symbol to be exported. Heads up: there's a small list of symbols that are not exported by default (peep--no-default-excludes). And you can add more to the do-not-export list with--exclude-symbols. π«--no-export-all-symbolsβ only export symbols explicitly listed in an input.deffile or in.drectvesections in the input object files. This is literally the default behaviour. Those.drectvesections get created bydllexportattributes in the source code. iykyk--exclude-symbols listβ do not export the symbols in list. It's a list of symbol names separated by comma or colon characters. Don't include a leading underscore on the names. Only meaningful when--export-all-symbolsis used. π--no-default-excludesβ when--export-all-symbolsis used, by default it avoids exporting certain special symbols. The current list of symbols it avoids exporting isDllMain@12,DllEntryPoint@0,impure_ptr. Want those special symbols exported anyway? This option says go ahead. Only meaningful when--export-all-symbolsis used. π-S path,--as pathβ the path, including the filename, of the assembler to use for creating the exports file.-f options,--as-flags optionsβ any specific command-line options to pass to the assembler when building the exports file. Works even if you didn't use-S. Important: this option only takes one argument, and if it shows up more than once on the command line, later occurrences override earlier ones. So if you need to pass multiple options to the assembler, wrap them in double quotes, bestie π-D name,--dll-name nameβ the name to be stored in the.deffile as the name of the DLL when the-eoption is used. If you don't pass this, then the filename you gave to-egets used as the DLL name instead.-m machine,-machine machineβ the type of machine the library file should be built for.dlltoolhas a built-in default type depending on how it was created, but this overrides that. Normally only useful when creating DLLs for an ARM processor, where the contents of the DLL are actually encoded using Thumb instructions. π¦-a,--add-indirectβ whendlltoolis creating the exports file, add a section that allows the exported functions to be referenced without using the import library. Whatever the hell that means! π-U,--add-underscoreβ whendlltoolis creating the exports file, prepend an underscore to the names of all exported symbols.--no-leading-underscore,--leading-underscoreβ whether a standard symbol should be forced to be prefixed, or not. Pick a lane π--add-stdcall-underscoreβ whendlltoolis creating the exports file, prepend an underscore to the names of exported stdcall functions. Variable names and non-stdcall function names are left alone. Slay for making GNU-compatible import libs for third-party DLLs that were built with MS-Windows tools. πΈ-k,--kill-atβ omit the@<number>suffixes from the names of stdcall functions that will be imported from the DLL. Useful when you're making an import library for a DLL that exports stdcall functions but without the usual@<number>symbol name suffix. βοΈ
This does not change the naming of symbols the import library provides to programs linked against it β only the entries in the import table (ie the .idata section).
-A,--add-stdcall-aliasβ whendlltoolis creating the exports file, add aliases for stdcall symbols without@ <number>, in addition to the symbols with@ <number>. Two for one π-p,--ext-prefix-alias prefixβ makesdlltoolcreate external aliases for all DLL imports with the specified prefix. The aliases are created for both external and import symbols with no leading underscore.-x,--no-idata4β whendlltoolis creating the exports and library files, omit the.idata4section. This is for compatibility with certain operating systems. π«Ά--use-nul-prefixed-import-tablesβ whendlltoolis creating the exports and library files, prefix the.idata4and.idata5by zero an element. This emulates old gnu import library generation ofdlltool. By default this option is turned off.-c,--no-idata5β whendlltoolis creating the exports and library files, omit the.idata5section. Also for compatibility with certain operating systems. π-I filename,--identify filenameβ inspect the import library named by filename and report, onstdout, the name(s) of the associated DLL(s). This can happen in addition to any other operations indicated by the other options and arguments.dlltoolfails if the import library doesn't exist or isn't actually an import library. See also--identify-strict. π--identify-strictβ modifies the behavior of--identifyso that an error is reported if filename is associated with more than one DLL. Strict queen π-i,--interworkβ mark the objects in the library file and exports file thatdlltoolproduces as supporting interworking between ARM and Thumb code. π€-n,--nodeleteβ makesdlltoolpreserve the temporary assembler files it used to create the exports file. Repeat this option and it'll also preserve the temporary object files it uses to create the library file. Keep the receipts π§Ύ-t prefix,--temp-prefix prefixβ use prefix when constructing the names of temporary assembler and object files. By default, the temp file prefix is generated from the pid.-v,--verboseβ makedlltooldescribe what it's doing. Narrator mode β¨-h,--helpβ displays a list of command-line options and then exits. Classic.-V,--versionβ displaysdlltool's version number and then exits. π@fileβ read command-line options from file. The options read are inserted in place of the original@fileoption. If file doesn't exist, or can't be read, then the option is treated literally, and it is not removed.
Options in file are separated by whitespace. A whitespace character may be included in an option by surrounding the entire option in either single or double quotes. Any character (including a backslash) may be included by prefixing the character to be included with a backslash. And the file may itself contain additional @file options β any such options get processed recursively. π
π SEE ALSO
The Info pages for binutils. That's the whole vibe, go read them bestie π«Ά
Β©οΈ COPYRIGHT
Copyright (c) 1991-2026 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU 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 "GNU Free Documentation License". π
okay that's the whole page, you ate that π this was binutils-2.46.1, dated 1980-01-01, and yes the page is literally titled DLLTOOL(1) β icon behavior, no cap πβ¨
π¦ where this page comes from
- nixpkgs unstable: coreboot-toolchain-ppc64 26.09
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms