Anyone comment on *.def files?

Erik van Pienbroek erik at
Mon Feb 9 17:27:48 UTC 2009

Op maandag 09-02-2009 om 16:04 uur [tijdzone +0000], schreef Richard
W.M. Jones:
> Some packages have *.def files, some don't, in some they are marked as
> executable (+x), in others not.
> Does anyone know for definite what they are for, who might use them?


During the review of mingw32-atk I already commented about the use
of .def files:

-- Begin quote:

The .def file contains a list of all the functions which need to be
exported in the .DLL file. It is only used by the linker. After a .DLL
has been made, the file has no further use (unless you want to create
Visual C++ import libraries, but there are other ways to generate those
from MinGW-compiled DLL's). When compiling other libraries/applicaties
the .def file isn't used, just the .dll and .dll.a files.

These .def files aren't created by libtool, but by some individual packages
(like glib2, atk, pango and gtk2) as part of the make job. This can be seen at (lines 139 to
150 and 168-169)

There was a page on the MinGW site with more details about this, but
unfortunately it got lost

-- End quote

The page on the MinGW site I was referring to is still missing, but hooray
for the internet archive: the page can still be found at

It gives you an explanation about how the .def files can be used to generate import libraries for use with Visual C++ (and the reverse).

As you can see the .def files can be re-generated by using a freely available tool called 'pexports' so it doesn't really matter whether these files are bundled in our packages or not.

One things for sure, the executable bit that some .def files may have is really useless as it just is a plain text file which is only used by the GCC linker, the MinGW dlltool and lib.exe of MSVC.


Erik van Pienbroek

More information about the mingw mailing list