Anyone comment on *.def files?

Erik van Pienbroek erik at vanpienbroek.nl
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?

Hi,

During the review of mingw32-atk I already commented about the use
of .def files: https://bugzilla.redhat.com/show_bug.cgi?id=467409#c8

-- 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
http://svn.gnome.org/viewvc/atk/trunk/atk/Makefile.am?view=markup (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 http://web.archive.org/web/20060212125114/http://mingw.sourceforge.net/mingwfaq.shtml#faq-msvcdll

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.

Regards,

Erik van Pienbroek





More information about the mingw mailing list