home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 May / Chip_2002-05_cd1.bin / chplus / cpp / 3 / Tools.exe / impdef.txt < prev    next >
Text File  |  1998-02-09  |  4KB  |  83 lines

  1. IMPDEF Help
  2.  
  3. IMPDEF takes as input a DLL name, and produces as output a module definition file with an
  4. export section containing the names of functions exported by the DLL.
  5. The syntax is:
  6.  
  7. IMPDEF DestName.DEF SourceName.DLL
  8.  
  9. This creates a module definition file named DestName.DEF from the file SourceName.DLL. The
  10. resulting module definition file would look something like this:
  11.  
  12. LIBRARY     FileName
  13. DESCRIPTION 'Description'
  14. EXPORTS
  15.             ExportFuncName              @Ordinal
  16.         .
  17.         .
  18.         .
  19.             ExportFuncName              @Ordinal
  20.  
  21. where:
  22.  
  23. FileName is the DLL's root file name
  24.      Description is the value of the DESCRIPTION statement if the DLL was previously
  25. linked with a module definition file that included a DESCRIPTION statement
  26.      ExportFuncName names an exported function
  27.      Ordinal is that function's ordinal value (an integer).
  28.  
  29. IMPDEF is useful for a DLL that uses C++ classes. If you use the _export keyword when
  30. defining a class, all of the non-inline member functions and static data members for that class are
  31. exported. It's easier to let IMPDEF make a module definition file for you because it lists all the
  32. exported functions, and automatically includes the member functions and static data members.
  33. Since the names of these functions are mangled, it would be tedious to list them all in the
  34. EXPORTS section of a module definition file simply to create an import library from the module
  35. definition file. If you use IMPDEF to create the module definition file, it will include the ordinal
  36. value for each exported function. If the exported name is mangled, IMPDEF will also include
  37. that function's unmangled, original name as a comment following the function entry. So, for
  38. instance, the module definition file created by IMPDEF for a DLL that used C++ classes would
  39. look something like this:
  40.  
  41. LIBRARY     FileName
  42. DESCRIPTION 'Description'
  43. EXPORTS
  44.             MangledExportFuncName  @Ordinal ; ExportFuncName
  45.         .
  46.         .
  47.         .
  48.             MangledExportFuncName  @Ordinal ; ExportFuncName
  49.  
  50. where
  51.  
  52. FileName is the DLL's root file name
  53.      Description is the value of the DESCRIPTION statement if the DLL was previously
  54. linked with a module definition file that included a DESCRIPTION statement
  55.      MangledExportFuncName provides the mangled name
  56.      Ordinal is that function's ordinal value (an integer)
  57.      ExportFuncName gives the function's original name.
  58.  
  59. IMPDEF creates an editable source file that lists all the exported functions in the DLL. You can
  60. edit this .DEF file to contain only those functions that you want to make available to a particular
  61. application, then run IMPLIB on the edited .DEF file. This results in an import library that
  62. contains import information for a specific subset of a DLL's export functions.
  63. Suppose you're distributing a DLL that provides functions to be used by several applications.
  64. Every export function in the DLL is defined with _export. Now, if all the applications used all
  65. the DLL's exports, then you could use IMPLIB to make one import library for the DLL. You
  66. could deliver that import library with the DLL, and it would provide import information for all of
  67. the DLL's exports. The import library could be linked to any application, thus eliminating the
  68. need for the particular application to list every DLL function it uses in the IMPORTS section of
  69. its module definition file.
  70.  
  71. But let's say you want to give only a few of the DLL's exports to a particular application. Ideally,
  72. you want a customized import library to be linked to that application--an import library that
  73. provides import information only for the subset of functions that the application will use. All of
  74. the other export functions in the DLL will be hidden to that client application.
  75. To create an import library that satisfies these conditions, run IMPDEF on the compiled and
  76. linked DLL. IMPDEF produces a module definition file that contains an EXPORT section listing
  77. all of the DLL's export functions. You can edit that module definition file, remove the
  78. EXPORTS section entries for those functions you don't want in the customized import library,
  79. and then run IMPLIB on the module definition file. The result will be an import library that
  80. contains import information for only those export functions listed in the EXPORTS section of
  81. the module definition file.
  82.  
  83. Copyright   1998 Borland International.