DLLTOOL(1)
๐ DLLTOOL(1) โ GNU Development Tools ๐
โจ NAME โจ
dlltool โ create files needed to build and use DLLs ๐
๐ฆ SYNOPSIS ๐ฆ
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 bestie, 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 a 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. periodt. ๐
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. iconic, 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. it's giving organized. ๐
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, no cap. ๐พ
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. import library supremacy. ๐
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. delay-import, fancy. ๐ฆ
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 are lowkey doing the most. ๐ ๏ธ
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. detective mode activated. ๐
okay bestie, buckle up โ this is the big one ๐ every single flag, no skips, no shortcuts, we're eating the whole menu ๐
โจ OPTIONS โจ
Here's what every single command-line option actually does, fr fr:
-d filename,--input-def filenameโ tells dlltool the name of a.deffile it should read in and process. give it the def, bestie ๐-b filename,--base-file filenameโ names a base file to read in and process. whatever's inside it gets added to the relocation section in the exports file dlltool generates. ๐ซถ-e filename,--output-exp filenameโ names the export file dlltool is gonna create.-z filename,--output-def filenameโ names the.deffile dlltool is gonna create.-l filename,--output-lib filenameโ names the library file dlltool is gonna create.-y filename,--output-delaylib filenameโ names the delay-import library file dlltool is gonna create.--deterministic-libraries,--non-deterministic-librariesโ when you're making output libraries for either--output-libor--output-delaylib, you pick one: either use zero for every timestamp, user id and group id that gets created (--deterministic-libraries), or use the actual real ones (--non-deterministic-libraries). same vibes, different clock โฐ--export-all-symbolsโ treat every global and weak defined symbol in the input object files as a symbol to export. there's a lil short list of symbols that don't get exported by default โ check--no-default-excludesfor that. and if you wanna add to the do-not-export list, use--exclude-symbols. ๐--no-export-all-symbolsโ only export symbols that are explicitly listed in an input.deffile or in.drectvesections in the input object files. this is the default behaviour, jsyk. those.drectvesections get created bydllexportattributes in the source code.--exclude-symbols listโ don't export the symbols in list. it's a list of symbol names separated by comma or colon characters, and the names should not have a leading underscore. this only actually means anything when--export-all-symbolsis in play.--no-default-excludesโ when--export-all-symbolsis used, dlltool by default avoids exporting certain special symbols. the current avoid-list isDllMain@12,DllEntryPoint@0,impure_ptr. use--no-default-excludesto go ahead and export those special ones anyway. again: only meaningful when--export-all-symbolsis used. ๐-S path,--as pathโ the path, filename included, of the assembler to use when creating the exports file.-f options,--as-flags optionsโ any specific command-line options you wanna pass to the assembler while building the exports file. it works even if-Sisn't used. โ ๏ธ heads up: 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.-D name,--dll-name nameโ the name to store in the.deffile as the DLL's name when-eis used. if you don't pass this, then the filename you gave to-ebecomes the DLL name.-m machine,-machine machineโ the type of machine the library file should be built for. dlltool has a built-in default type depending on how it was created, but this overrides it. normally only useful when you're making DLLs for an ARM processor and the DLL contents are actually encoded using Thumb instructions. (yes,-machineis one dash. no, we don't question it.) ๐-a,--add-indirectโ when dlltool creates the exports file, it should add a section letting the exported functions be referenced without using the import library. whatever the hell that means! ๐ญ (that's straight from the source, bestie, I don't make the rules)-U,--add-underscoreโ when dlltool creates 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.--add-stdcall-underscoreโ when dlltool creates the exports file, prepend an underscore to the names of exported stdcall functions. variable names and non-stdcall function names stay untouched. this is the move when you're creating 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'll 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.
important, don't miss this: it 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โ when dlltool creates the exports file, add aliases for stdcall symbols without@ <number>in addition to the symbols with@ <number>.-p,--ext-prefix-alias prefixโ makes dlltool create external aliases for all DLL imports using the specified prefix. the aliases are made for both external and import symbols, with no leading underscore.-x,--no-idata4โ when dlltool creates the exports and library files, omit the.idata4section. this is for compatibility with certain operating systems. ๐--use-nul-prefixed-import-tablesโ when dlltool creates the exports and library files, prefix the.idata4and.idata5by zero an element. this emulates the old gnu import library generation ofdlltool. by default this option is turned off. (it's giving retro ๐พ)-c,--no-idata5โ when dlltool creates the exports and library files, omit the.idata5section. again, compatibility with certain operating systems.-I filename,--identify filenameโ dlltool should inspect the import library named by filename and report, onstdout, the name(s) of the associated DLL(s). you can do this alongside any other operations the other options and arguments indicate. dlltool fails if the import library doesn't exist or isn't actually an import library. see also--identify-strict. ๐ต๏ธ--identify-strictโ tweaks how--identifybehaves, so an error gets reported if filename is associated with more than one DLL. one DLL or we riot.-i,--interworkโ dlltool should mark the objects in the library file and exports file it produces as supporting interworking between ARM and Thumb code. ๐ค-n,--nodeleteโ makes dlltool preserve the temporary assembler files it used to create the exports file. if you repeat this option, dlltool will also preserve the temporary object files it uses to create the library file. double it up for double the hoarding ๐๏ธ-t prefix,--temp-prefix prefixโ 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.-v,--verboseโ make dlltool describe what it's doing. narrate your life king ๐-h,--helpโ displays a list of command-line options, then exits.-V,--versionโ displays dlltool's version number, then exits.@fileโ read command-line options from file. the options that get 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 not removed. ๐ฎ
options inside file are separated by whitespace. a whitespace character can be included in an option by surrounding the whole option in either single or double quotes. any character at all (including a backslash) can be included by prefixing the character to be included with a backslash. and file can itself contain additional @file options โ any of those get processed recursively. ๐ it's files all the way down.
๐ SEE ALSO ๐
- the Info pages for binutils. (iykyk, go read them ๐)
๐ COPYRIGHT ๐
Copyright (c) 1991-2025 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".
and that's the whole page, bestie โ slayed, no skips, every flag accounted for ๐ โจ this was binutils-2.45.50, dated 2026-01-13, and it's giving DLLTOOL(1). periodt. ๐๐ฆ
๐ฆ where this page comes from
- ubuntu resolute: binutils-riscv64-unknown-elf 2.45.50.20251209-1ubuntu1+7build1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms