binutils: def file format
13.1 The format of the 'dlltool' '.def' file
============================================
A '.def' file contains any number of the following commands:
'NAME' NAME '[ ,' BASE ']'
The result is going to be named NAME'.exe'.
'LIBRARY' NAME '[ ,' BASE ']'
The result is going to be named NAME'.dll'. Note: If you want to
use LIBRARY as name then you need to quote. Otherwise this will
fail due a necessary hack for libtool (see PR binutils/13710 for
more details).
'EXPORTS ( ( (' NAME1 '[ = ' NAME2 '] ) | ( ' NAME1 '=' MODULE-NAME '.' EXTERNAL-NAME ') ) [ == ' ITS_NAME ']'
'[' INTEGER '] [ NONAME ] [ CONSTANT ] [ DATA ] [ PRIVATE ] ) *'
Declares NAME1 as an exported symbol from the DLL, with optional
ordinal number INTEGER, or declares NAME1 as an alias (forward) of
the function EXTERNAL-NAME in the DLL. If ITS_NAME is specified,
this name is used as string in export table. MODULE-NAME. Note:
The 'EXPORTS' has to be the last command in .def file, as keywords
are treated - beside 'LIBRARY' - as simple name-identifiers. If
you want to use LIBRARY as name then you need to quote it.
'IMPORTS ( (' INTERNAL-NAME '=' MODULE-NAME '.' INTEGER ') | [' INTERNAL-NAME '= ]' MODULE-NAME '.' EXTERNAL-NAME ') [ == ) ITS_NAME ] *'
Declares that EXTERNAL-NAME or the exported function whose ordinal
number is INTEGER is to be imported from the file MODULE-NAME. If
INTERNAL-NAME is specified then this is the name that the imported
function will be referred to in the body of the DLL. If ITS_NAME is
specified, this name is used as string in import table. Note: The
'IMPORTS' has to be the last command in .def file, as keywords are
treated - beside 'LIBRARY' - as simple name-identifiers. If you
want to use LIBRARY as name then you need to quote it.
'DESCRIPTION' STRING
Puts STRING into the output '.exp' file in the '.rdata' section.
'STACKSIZE' NUMBER-RESERVE '[, ' NUMBER-COMMIT ']'
'HEAPSIZE' NUMBER-RESERVE '[, ' NUMBER-COMMIT ']'
Generates '--stack' or '--heap' NUMBER-RESERVE,NUMBER-COMMIT in the
output '.drectve' section. The linker will see this and act upon
it.
'CODE' ATTR '+'
'DATA' ATTR '+'
'SECTIONS (' SECTION-NAME ATTR' + ) *'
Generates '--attr' SECTION-NAME ATTR in the output '.drectve'
section, where ATTR is one of 'READ', 'WRITE', 'EXECUTE' or
'SHARED'. The linker will see this and act upon it.