You need to use command called dlltool. It create files needed to build and use DLLs. dlltool reads its inputs, which can come from the -d and -b options as well as object files specified on the command line. It then processes these inputs and if the -e option has been specified it creates an 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.
Here is an example of creating a DLL from a source file dll.c:
$ gcc -c dll.c
$ dlltool -e exports.o -l dll.lib dll.o
$ gcc dll.o exports.o -o dll.dll
- -c : Specifies that when dlltool is creating the exports and library files it should omit the ".idata5" section. This is for compatibility with certain operating systems.
- -e: Specifies the name of the export file to be created by dlltool.
- -l : Specifies the name of the library file to be created by dlltool.
Creating a program (from an object file called program.o) that uses that DLL:
$ gcc program.o dll.lib -o program
Read the man page of dlltool for more information.TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!
- 30 Cool Open Source Software I Discovered in 2013
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop