objmedia.demon.co.uk

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.

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.

About Us | Site Map | Legal | Contact Us | ©1994-2008: Object Media Ltd : all rights reserved: registered in England No. 297036