function::MKDEF - Linux


function::MKDEF is a command used to create a ".def" file for a dynamic linked library (DLL). It generates a definition file containing the library’s exported functions and data. A ".def" file is essential for enabling access to a DLL’s symbols when linking executables.


function::MKDEF [-o <output-file>] [-n <dll-name>] [-e <entry-point>] [-y <MS-style>] [-D <define>] <input-file>


  • -o : Specifies the output ".def" file.
  • -n : Sets the name of the DLL to be exported.
  • -e : Defines the entry point of the DLL.
  • -y : Creates an MS-style ".def" file (for compatibility with Microsoft tools).
  • -D : Adds a preprocessor define to the generated file.


Creating a basic ".def" file:

function::MKDEF -n my_dll.dll symbols.h

Creating an MS-style ".def" file:

function::MKDEF -y -n my_dll.dll symbols.h

Adding a preprocessor define:

function::MKDEF -n my_dll.dll -D DEBUG symbols.h

Common Issues

  • Missing or invalid input file: Ensure the specified input file exists and contains valid function and data definitions.
  • Symbol conflicts: Check for duplicate symbols in the input file or with existing symbols in other linked libraries.
  • Incorrect entry point: Verify that the specified entry point is valid and corresponds to the actual DLL entry point function.


function::MKDEF can be integrated with the following commands:

  • dlltool: Creates or modifies DLLs based on ".def" files.
  • ar: Archives ".def" files into static libraries.
  • gcc, clang: Compilers that use ".def" files when linking against DLLs.

Related Commands

  • DEF: Creates ".def" files for Windows systems.
  • readelf: Displays information about ELF executables and libraries (including ".def" files).