Red Hat ENTERPRISE LINUX 4 - USING BINUTILS Manuale Utente Pagina 56

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 80
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 55
50 Chapter 14. Create files needed to build and use DLLs
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.
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. This file can be created by giving the -l option to dlltool when it is creating
or reading in a .def file.
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.
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
The command line options have the following meanings:
-d filename
-input-def filename
Specifies the name of a .def file to be read in and processed.
-b filename
-base-file filename
Specifies the name of a base file to be read in and processed. The contents of this file will be
added to the relocation section in the exports file generated by dlltool.
-e filename
-output-exp filename
Specifies the name of the export file to be created by dlltool.
-z filename
-output-def filename
Specifies the name of the .def file to be created by dlltool.
-l filename
-output-lib filename
Specifies the name of the library file to be created by dlltool.
-export-all-symbols
Treat all global and weak defined symbols found in the input object files as symbols to be
exported. There is a small list of symbols which are not exported by default; see the
-no-default-excludes option. You may add to the list of symbols to not export by using the
-exclude-symbols option.
Vedere la pagina 55
1 2 ... 51 52 53 54 55 56 57 58 59 60 61 ... 79 80

Commenti su questo manuale

Nessun commento