Previous: Creating the Definition File, Up: Building DLLs with GNAT


F.9.7 Using gnatdll

gnatdll is a tool to automate the DLL build process once all the Ada and non-Ada sources that make up your DLL have been compiled. gnatdll is actually in charge of two distinct tasks: build the static import library for the DLL and the actual DLL. The form of the gnatdll command is

     

$ gnatdll [switches] list-of-files [-largs opts]

where list-of-files is a list of ALI and object files. The object file list must be the exact list of objects corresponding to the non-Ada sources whose services are to be included in the DLL. The ALI file list must be the exact list of ALI files for the corresponding Ada sources whose services are to be included in the DLL. If list-of-files is missing, only the static import library is generated.

You may specify any of the following switches to gnatdll:

-a[address]
Build a non-relocatable DLL at address. If address is not specified the default address 0x11000000 will be used. By default, when this switch is missing, gnatdll builds relocatable DLL. We advise the reader to build relocatable DLL.
-b address
Set the relocatable DLL base address. By default the address is 0x11000000.
-bargs opts
Binder options. Pass opts to the binder.
-d dllfile
dllfile is the name of the DLL. This switch must be present for gnatdll to do anything. The name of the generated import library is obtained algorithmically from dllfile as shown in the following example: if dllfile is xyz.dll, the import library name is libxyz.a. The name of the definition file to use (if not specified by option -e) is obtained algorithmically from dllfile as shown in the following example: if dllfile is xyz.dll, the definition file used is xyz.def.
-e deffile
deffile is the name of the definition file.
-g
Generate debugging information. This information is stored in the object file and copied from there to the final DLL file by the linker, where it can be read by the debugger. You must use the -g switch if you plan on using the debugger or the symbolic stack traceback.
-h
Help mode. Displays gnatdll switch usage information.
-Idir
Direct gnatdll to search the dir directory for source and object files needed to build the DLL. (see Search Paths and the Run-Time Library (RTL)).
-k
Removes the @nn suffix from the import library's exported names. You must specified this option if you want to use a Stdcall function in a DLL for which the @nn suffix has been removed. This is the case for most of the Windows NT DLL for example. This option has no effect when -n option is specified.
-l file
The list of ALI and object files used to build the DLL are listed in file, instead of being given in the command line. Each line in file contains the name of an ALI or object file.
-n
No Import. Do not create the import library.
-q
Quiet mode. Do not display unnecessary messages.
-v
Verbose mode. Display extra information.
-largs opts
Linker options. Pass opts to the linker.