README.TXT Documentation for DLLXPORT.EXE Utility Copyright (c) 1994-1995 by Paul Fonte (CIS:76500,3534) Version 3.0: Version 3.0 incorporates many feature additions and enhancements. Among the most significant are: * Dllxport now comes in two flavors: Dos and Win32 Console. The Win32 Console application supports long filenames and universal paths. * Automatic detection of OBJ type. The /Win32 and /Win16 switches are used only to specify which target platform's default .DEF file header to use in the output. * Support of COFF archives. The .LIB format from Microsoft is similar to the COFF ar format and is now fully supported in Dllxport. * Persist DEF file headers along with the orindals. The DLLXPORT_START comment token is used to signal Dllxport to carry over all preceding lines, which might include hand-exported functions. example.def: LIBRARY EXAMPLE DESCRITION 'EXAMPLE_DLL' ...... EXPORTS _my_hand_export_1 @1 NONAME _my_hand_export_2 @2 NONAME ... _my_hand_export_n @n NONAME ; DLLXPORT_BEGIN: ; ... <> All lines before the DLLXPORT_BEGIN: token will be carried over from the reference .DEF to the generated .DEF. * Faster parsing algorithms should make Dllxport less burdensome to run in the middle of a make. * No limit on the number of exports. Dllxport will parse and stream exports uyntil memory is exhausted (which is a very long time in WindowsNT). * Borland C++ 4.0 unmangling in the verbose output is now provided for those Borlophiles using the utility. * Enhanced command-line parsing will make Dllxport easier to use, especially when prototyping. Tokens can be squeezed together (/otest.def == /o test.def) Wildcards can be used (dllxport windebug\*.obj). Purpose: DLLXPORT eliminates the need to manually maintain .DEF files for Visual C++ .DLL's by creating the .DEF file from the .OBJ's used to create it. Method: Place a target in the makefile to create a project .DEF file for the .DLL before LINK is run, them run IMPLIB on the .DEF to create the import library. Example Usage: For an IDE .DLL makefile, the creation of the import library usually looks like: ... $(PROJ).DLL:: INIT.OBJ SOURCE1.OBJ SOURCE2.OBJ $(OBJS_EXT) $(DEFFILE) echo >NUL @<<$(PROJ).CRF INIT.OBJ + SOURCE1.OBJ + SOURCE2.OBJ + $(OBJS_EXT) $(PROJ).DLL $(MAPFILE) c:\msvc\lib\+ c:\msvc\mfc\lib\+ ..\lib\+ $(LIBS) $(DEFFILE); << link $(LFLAGS) @$(PROJ).CRF $(RC) $(RESFLAGS) VIRTGRID.RES $@ @copy $(PROJ).CRF MSVC.BND implib /nowep $(PROJ).LIB $(PROJ).DLL ... Automatimg the .DEF file creation involves adding another dependency and changing the IMPLIB command line: ... $(PROJ).DLL:: INIT.OBJ SOURCE1.OBJ SOURCE2.OBJ $(OBJS_EXT) $(DEFFILE) echo >NUL @<<$(PROJ).CRF INIT.OBJ + SOURCE1.OBJ + SOURCE2.OBJ + $(OBJS_EXT) + $(PROJ).DLL + $(MAPFILE) + c:\msvc\lib\ + c:\msvc\mfc\lib\ + ..\lib\ + $(LIBS) + $(DEFFILE); << link $(LFLAGS) @$(PROJ).CRF $(RC) $(RESFLAGS) VIRTGRID.RES $@ @copy $(PROJ).CRF MSVC.BND implib /nowep $(PROJ).LIB $(DEFFILE) # ^^^^^^^^^^ ######### $(DEFFILE): DLLXPORT /M /V /Win16 /O $(DEFFILE) /I << SOURCE1.OBJ SOURCE2.OBJ << ######### ... Notes: L2025 Build Error: For MFC extension _AFXDLL's (the destination impetus for this utility), do not include the module which has the line: '#include ', you will get duplicate symbol linker errors by exporting the memory handlers. It is a good idea to place this #include statment in your precompiled header module. Compiler switches: the /Gy compiler flag is incompatible with this program. The /O1 optimization flag implies /Gy, if small-code optimization is required, you may have to resort to compiling without that flag, saving the .DEF file and recompiling with it. The /NOPACKF option prevents the removal of unreferenced packaged functions, which may be created with the /Gy compiler option and are always created by C++ member functions. The default action of the linker is to remove unreferenced packaged functions. See "Enable Function Level Linking" in Chapter 1 of the Command-Line Utilities User's Guide for a description of packaged functions. Note If you are linking a dynamic-link library for Windows or a Visual Basic custom control which was compiled with the /O1 optimizing option, select this option to prevent removal of exported functions. The /O1 option implies the /Gy option. There is a bug in IMPLIB 1.50 which causes it to fail on an exported name greater than 127 characters in length. While neither the programmer nor this program has any control of the length of a mangled name, it is a problem that could come up. Microsoft has instructed us to use shorter symbol names to avoid this problem. Thanks MS! See Q117797. DLLXPORT Command Line: DLLXPORT [[options]] [objectfile] Options: @ [commandfile] Supply more options from a command file, CR-delimited. /B[[are output]] Suppress copyright message /H[[eader]] [headerfile] Use headerfile for .DEF header /I[[nput]] [modulefile] Get module names from CR-delimited file /M[[aintain ordinals]] Maintain the ordinal assignments found in the already. Any new exports will recewive greater than any found in the previous / /O[[utput]] [outfile] Send output to Normally, output goes to standard output /P[[adding]] [padcount] Set padding for each modules's ordinals, ordinal spaces are added after each object file processed /R[[eference]] [reffile] Use the supplied as a reference for setting ordinals. This is the same procedure as /M but an alternative file is used. /S[[tart]] [firstnumber] Set beginning ordinal number. If is 0, the exporting by ordinal number is suppressed, all publics are exported by name. /V[[erbose output]] Each entry in the DEF file will be preceeded by its unmangled name (for MS mangling only) as a comment line. /Win16 Produces a DEF default header for Win16 targets. /Win32 Produces a DEF default header for Win32 targets. /? Display brief usage summary Version History 1.00 - initial revision 1.10 - fixed max src file exceeded lockup, added lots of error reporting 1.20 - fixed pubdef parsing bug 2.00 - added COFF support, added ordinal persistence and verbose format 2.01 - added error message for OBJ-type mismatching 2.02 - added warning for Implib exported name length bug 3.00 - available as Win32 console app, autodetection of OBJ type, support of COFF archives, persistent headers for reference files, improved parsinging speed for all filetypes, capacity limited by available memory only, unmangling of Borland C++ 4.0 names, improved command parsing. 3.04 - added Win32 checking for leading underscores. The MSC9 linker cannot handle leading underscores for cdecl functions, so Dllxport will strip them before includeing them in the DEF output. Also, there were bugs in the /P and /S options which control ordinal numbering. DISCLAIMER - AGREEMENT Users of DLLXPORT must accept this disclaimer of warranty: "DLLXPORT is supplied as is. The author disclaims all warranties, expressed or implied, including, without limitation, the warranties of merchantability and of fitness for any purpose. The author assumes no liability for damages, direct or conse- quential, which may result from the use of DLLXPORT." DLLXPORT is a "shareware program" and is provided at no charge to the user for evaluation. Feel free to share it with your friends, but please do not give it away altered or as part of another system. The essence of "user-supported" software is to provide personal computer users with quality software without high prices, and yet to provide incentive for programmers to continue to develop new products. If you find this program useful and find that you are using DLLXPORT and continue to use DLLXPORT after a reasonable trial period, you must make a reg- istration payment of $20 to N&P Associates. The $20 registration fee will license one copy for use on any one computer at any one time. You must treat this software just like a book. An example is that this software may be used by any number of people and may be freely moved from one computer location to another, so long as there is no possibility of it being used at one location while it's being used at another. Just as a book cannot be read by two different persons at the same time. Commercial users of DLLXPORT must register and pay for their copies of DLLXPORT within 30 days of first use or their license is withdrawn. Site-License arrangements may be made by contacting N&P Associates. Gratitude: This utility is provided free of charge to all who wish to evaluate it. If you like it and it saves you time and energy and make you money, please help contribute to my son's college fund by reimbursing me for my effort. Any contribution is welcomed, $20 is suggested. For an additional $20, source code to the utility is available (without support). !!! ONLINE REGISTRATION !!! You can register online at CompuServe and the commercial version will be emailed to the registration account as soon as possible. The process is simple, just !GO SWREG and follow the directions using the following registration numbers: DLLXPORT registration #3927 (v3.0 without source) DLLXPORT registration #3928 (v3.0 with source) !!! MANUAL REGISTRATION !!! For those unwilling to give Compuserve a 15% share of your registration fee, you can register directly with N&P Associates. Please send checks to: Paul Fonte N&P Associates 2800 Windwood Dr. #130 Ann Arbor MI 48105 The commercial version will be emailed if possible, if not, it will be snail-mailed at the luxury of the post office.