objmedia.demon.co.uk

Win32 .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 Win32 project that was ported from Win16. 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 32 bit DLL

Sample build process for a 32 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
REM 
REM     To build a debug version of the program from the MS-DOS prompt, type
REM nmake /f TESTDLL32.MAK CFG="Win32 Debug"
REM     or to build a release version of the program, type
REM nmake /f TESTDLL32.MAK CFG="Win32 Release"

del util32.map
def32 /clean util32.def

d:\msvc20\bin\nmake /A /I /f util32.mak CFG="Win32 Debug"

def32 /verbose /iProtected util32.def util32.map /rsp util32.rsp > util32.t

d:\msvc20\bin\nmake /I /f util32.mak CFG="Win32 Debug"

REM del util.lib
REM d:\msvc20\bin\implib /NOIGNORECASE /DEF:util32.def util32.lib 

Sample output .def file

Part of the output of def32.exe is shown here.

; util32.def : Declares the module parameters for the DLL.

LIBRARY      UTIL32
DESCRIPTION  'UTIL32 Windows Dynamic Link Library'

EXPORTS
; Explicit exports can go here
;autogen-object-media-export-start
    _DllMain@12 @100 NONAME
    ??0ERROR_STACK@@QAE@XZ @101 NONAME
    ??1ERROR_STACK@@QAE@XZ @102 NONAME
    ?ErrorReset@ERROR_STACK@@SAXXZ @103 NONAME
    ?ErrorStack@ERROR_STACK@@SA?AW4_error_code@@W42@HPAD1@Z @104 NONAME
    ?getErrorDefinition@ERROR_STACK@@QAEPBDXZ @105 NONAME
    ?getStack@ERROR_STACK@@SAPAV1@XZ @106 NONAME

    ...

    ?lpfnSuperWndProc@CParsedEditExported@@1P6GJPAUHWND__@@IIJ@ZA @2468 NONAME
    ??_C@_0BI@JEFD@D?3?2OM?2C?2tm?2PAREDIT2?4CPP?$AA@ @2469 NONAME
    ??_C@_04OJPN@edit?$AA@ @2470 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