Win16 .def file generator
This is a def file generator for those of you unfortunate to need it, but who have not written one. We wrote this for a 300,000 line Win16 project. Source code is provided. Note that this source code was produced ad-hoc as we determined through trial and error what was and what was not needed in .def files. The source code is not representative of the code in our products.
This program is provided with source code. If you find any bugs with this program, please let us know: bugs@objmedia.demon.co.uk.
You use this program at your own risk. Object Media will not be responsible for any loss or damage that may arise from using this program or a derivative of this program.
Download the source.
Download the executable and the common files installer.
Command Line Options
The def16 program supports the following command line options.
- /verbose. Display verbose output.
- /exports. Write symbols as exports.
- /imports moduleName. (i.e. util for util.dll). Write symbols as imports.
- /clean. Clean definition file and quit.
- /help. Display help message.
- /?. Display help message.
- /rsp responsefile. Specify the response file.
- /type {0, 1, 2}.
- 0 All function link types.
- 1 Imported function link types.
- 2 Absolute function link types.
- /iClass. Import classes.
- /iPublic. Import public functions.
- /iProtected.Import protected functions.
- /iPrivate. Import private functions.
- /iUnknown. Import unknown functions.
- /iCDecl. Import C functions.
- /noiClass. Do not import classes.
- /noiPublic. Do not import public functions.
- /noiProtected. Do not import protected functions.
- /noiPrivate. Do not import private functions.
- /noiUnknown. Do not import unknown functions.
- /noiCDecl. Do not import C functions.
Sample response (.rsp) file
A sample response file is shown below
; Response file for the def.exe definitions file builder for util.def ; errors.h colour.h memdebug.h parser.h parstree.h token.h vector.h fontcach.h attrib.h date.h filter.h paredit.h d_valid.h ; these two header files should define some classes, but somehow manage not to! sfttb.h sfttree.h ; ; define some class names that are not strictly specified in header files ; class:CSftTabs class:CSftTabsDialog class:CSftTabsPage class:CSftTree
Sample build process for a 16 bit DLL
Sample build process for a 16 bit DLL using def16.
REM To build a DLL properly we must do the following:- REM 1) Initialise the .def file to have no exports in it REM 2) Compile and link the DLL REM 3) Create a definition file from the map fil REM 4) Re-link the DLL REM 5) Build the import library pushd edittool del edittool.map def16 /clean edittool.def nmake /A /I /f edittool.mak def16 /verbose edittool.def edittool.map /rsp edittool.rsp > edittool.t nmake /I /f edittool.mak del edittool.lib d:\msvc\bin\implib /NOIGNORECASE edittool.lib edittool.def popd REM move DLLs to where we need them copy edittool\edittool.dll copy edittool\edittool.dll sample
Sample output .def file
Part of the output of def16.exe is shown here.
LIBRARY UTIL
EXETYPE WINDOWS
CODE LOADONCALL MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE SINGLE
SEGMENTS
_TEXT PRELOAD MOVEABLE DISCARDABLE
WEP_TEXT PRELOAD MOVEABLE DISCARDABLE
HEAPSIZE 1024
; may want to make 2000...
EXPORTS
; WEP @1 RESIDENTNAME
;EXPORTS
; WEP PRIVATE
; To implement your own Windows Exit Procedure add the following
; function to your application (referring to it in the .def file is
; not required.) The extern "C" is only required if module is C++.
; extern "C" int FAR PASCAL _WEP(int)
; {
; /* Your WEP functionality goes here */
; return 1;
; }
WEP @1 RESIDENTNAME PRIVATE ;; required WEP entry point (uses library WEP)
; Explicitly exported initialization routine
;INITUTILDLL @2
;autogen-object-media-export-start
INITUTILDLL @100 NONAME
??0CFontCache@@REC@XZ @103 NONAME
??0CParsedEdit@@REC@W4_valid_style@@@Z @104 NONAME
??0CParsedEdit@@REC@XZ @105 NONAME
??0CParsedEditExported@@REC@PBUHWND__@@@Z @106 NONAME
....
?xyModeStrs@@3QEPFDE @788 NONAME
?zIndexStrs@@3QEPFDE @789 NONAME
;autogen-object-media-export-end
Last Updated 7 February, 2008.

