KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q47225: .DEF File Optional Internal Names Not Supported by Implib

Article: Q47225
Product(s): See article
Version(s): 5.10   | 5.10
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | OPSYS PMWIN BUSLANG | mspl13_c
Last Modified: 17-AUG-1989

The implib utility does not put the optional internal name of a
dynamically linked function into the import library it creates. Implib
puts only the entry name of the function (the function name that
external modules call) into the import library.

The use of optional internal names is supported only by linking with
the module definition file (.DEF) that specifies the internal function
names (the actual function names in the source file) within a Dynamic
Link Library (DLL) for OS/2 or DOS Windows.

In a .DEF file, you can optionally specify aliases for the entry
points into your DLL as in the following .DEF file statement:

EXPORTS
    ENTRYNAME=INTERNALNAME

ENTRYNAME is the name of a DLL routine called by other modules, and
the optional INTERNALNAME is the actual name of the function or
procedure in the DLL. By default, the INTERNALNAME is the same as the
ENTRYNAME, but you may want to provide more meaningful entry names to
the users of your DLL in addition to the actual internal function
names.

The names of dynamically linked functions in a DLL must be specified
in either a .DEF file or in an import library, which has a .LIB
extension, so that the linker can resolve all references (calls) to
the DLL functions. Attempting to link an application that calls DLL
functions without an import library or .DEF file results in LINK :
error L2029: Unresolved externals: for the DLL function names.

Import libraries, consisting of little more than the names of the
modules in the DLL and the externally callable functions within the
DLL, are created by the implib utility from an existing .DEF file with
a command such as the following, which creates the import library
"myimport.lib" from the existing module definition file "myfile.def":

   implib myimport.lib myfile.def

Commonly used import libraries for OS/2 are DOSCALLS.LIB for the OS/2
1.00 API (Application Program Interface) DLL routines, OS2.LIB for
OS/2 1.10, or CRTLIB.LIB for the multi-thread C 5.10 run-time
CRTLIB.DLL. The Windows Software Development Kit for creating DOS
Windows applications comes with memory model-specific import libraries
such as SLIBW.LIB.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.