home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / trimdll1.zip / TRIMDLL1.INF (.txt) < prev   
OS/2 Help File  |  1997-03-24  |  17KB  |  391 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. TrimDll Version 1.0 ΓòÉΓòÉΓòÉ
  3.  
  4. A utility to tailor your UICL distribution DLLs. 
  5. This program follows more or less the hints given in IBM's 'VAC++ Open Class 
  6. Library User's Guide', Chapter 27, 'Rebuilding the Open Class Library DLLs'. (I 
  7. may use quotations from that book within my text). In addition, based on some 
  8. personal experiences, a more specific step-by-step instruction is given. 
  9.  
  10.  
  11. ΓòÉΓòÉΓòÉ 1.1. What you can do with the program ΓòÉΓòÉΓòÉ
  12.  
  13. You can compose a new response file from one of the original IOC response files 
  14. (CPPOOB3.RSP, CPPOOU3.RSP, CPPOOD3.RSP, CPPOOM3.RSP), create a new definition 
  15. file from these with only the required exports, and link the selected object 
  16. modules into a new DLL. This will reduce required space on your distribution 
  17. media and the installed application. It can also result in faster load time for 
  18. the application. 
  19.  
  20.  
  21. ΓòÉΓòÉΓòÉ 1.2. What you need to know ΓòÉΓòÉΓòÉ
  22.  
  23. Remember: 
  24. You are not allowed to deliver the original runtime libraries when you 
  25. distribute a program you wrote using IBM's CSet++ or VAC++. Instead, you must 
  26. link it statically or rename the required DLL's and ship them as a whole. Both 
  27. options will blow up your package, even if you used only some of the provided 
  28. classes within that program. 
  29. Another way is to rebuild the DLL's by removing classes not needed. This is 
  30. always an annoying job, because you have to take care about not to remove too 
  31. many object module names and to keep the required exports in sequence. It's 
  32. here where this program could help. 
  33.  
  34. Using the UICL from VAC++ with dynamic linking, you are dealing with this 
  35. libraries: 
  36.  
  37.      CPPOS30.DLL - always needed for single threads 
  38.      CPPOM30.DLL - always needed for multi threads 
  39.      CPPOOB3.DLL - the application support- and collection-classes 
  40.      CPPOOU3.DLL - the the UI classes 
  41.      CPPOOM3.DLL - the multimedia support  (IMM*.OBJs) 
  42.      CPPOOD3.DLL - the DDE support      (IDDE*.OBJs) 
  43.  
  44.  These recommendations are basically given for modifications, : 
  45.  
  46.      From CPPOOB3.RSP 
  47.         -  remove all N*.OBJ    if you never use I_NO_INLINES when compiling 
  48.      From CPPOOU3.RSP 
  49.         -  remove all ICNR*.OBJ  if you do not use container controls 
  50.         -  remove all IDM*.OBJ   if you do not use direct manipulation or 
  51.            toolbar 
  52.      For CPPOOM3.DLL and CPPOOD3.DLL 
  53.         -  not needed       if you never use multimedia and/or DDE classes 
  54.  
  55.  This will already reduce the space needed. But there could be more to omit, 
  56.  and up to a certain complexity, it might be worth to play around to save some 
  57.  more 100k in size. 
  58.  
  59.  
  60. ΓòÉΓòÉΓòÉ 1.3. What you need before you start ΓòÉΓòÉΓòÉ
  61.  
  62. There are some files you need to prepare before you can rebuild the DLLs. 
  63.  
  64.  
  65. ΓòÉΓòÉΓòÉ 1.3.1. The distributed files you need ΓòÉΓòÉΓòÉ
  66.  
  67. Needed files that are shipped with the distribution package are the 
  68. definition(.def) and the response(.rsp) files for the DLLs to modify and the 
  69. GETOBJS command file to extract the object modules. They are installed in the 
  70. \IBMCPP\IOCDLL directory. 
  71.  
  72.  
  73. ΓòÉΓòÉΓòÉ 1.3.2. Create new directories and files (my recommendation) ΓòÉΓòÉΓòÉ
  74.  
  75. To avoid mixing of distribution and generated files, you should put the new 
  76. files into separate directories. Create two new directories named \LIBS and 
  77. \OBJS under the existing IBMCPP\IOCDLL directory, p.e.. 
  78. Copy the GETOBJS.CMD file into the new \OBJS. This is for backup and comfort. 
  79.  
  80. Note:  You might need to change the old LIB command in the GETOBJS.CMD to ILIB 
  81. according to the changes in VACPP. 
  82.  
  83.  
  84. ΓòÉΓòÉΓòÉ 1.3.3. Extract the object modules ΓòÉΓòÉΓòÉ
  85.  
  86. Extract the necessary object modules from the Open Class Library static library 
  87. CPPOOC3.LIB using the GETOBJS.CMD. 
  88.  
  89. EXAMPLE:
  90.          cd\ibmcpp\iocdll\objs
  91.          GETOBJS ..\..\lib\CPPOOC3.LIB
  92.  
  93. This will place the object modules into the new \objs\ directory. 
  94.  
  95.  
  96. ΓòÉΓòÉΓòÉ 1.3.4. Create the import library files ΓòÉΓòÉΓòÉ
  97.  
  98. Create the necessary import library files (CPPOOB3I.LIB, CPPOOU3I.LIB if you 
  99. are going to relink the Multimedia and DDE- Dlls as well) with the existing 
  100. definition files using the IMPLIB utility. 
  101.  
  102. EXAMPLE:
  103.          cd..
  104.          IMPLIB .\libs\CPPOOB3I.LIB CPPOOB3.DEF
  105.          IMPLIB .\libs\CPPOOU3I.LIB CPPOOU3.DEF
  106.  
  107. This will create the needed import libraries. 
  108.  
  109.  
  110. ΓòÉΓòÉΓòÉ 1.3.5. Install the TrimDll Program ΓòÉΓòÉΓòÉ
  111.  
  112. Install the TrimDll program and its cross-reference files where ever you want. 
  113. New DLLs, along with other created files, will be placed into that directory. 
  114. Create an object for this if you like. 
  115. You should now be ready to run the program following the instructions. There 
  116. are two approaches to create a new response file: 
  117.  
  118.      Copy only the needed items from reference to the target box. 
  119.      Copy all items from the reference to the target box and delete unneeded 
  120.       ones from the target. 
  121.  
  122.  It's up to you which method you prefer, but you might leave more names in the 
  123.  target than needed if you choose the second method. See note in step 2.2.. 
  124.  
  125.  
  126. ΓòÉΓòÉΓòÉ 1.4. A Guided Introduction. ΓòÉΓòÉΓòÉ
  127.  
  128. Selectable Topics: 
  129.  
  130.        Open a reference response file 
  131.        Select items to copy 
  132.        Copy items 
  133.        Delete items 
  134.        Create a new definition file 
  135.        Link the new DLL file 
  136.        Inspecting output 
  137.        Help for LNKXXXX Messages 
  138.        Restart after errors 
  139.        Saving your work 
  140.        Restart from a file 
  141.        Copy and Rename CPPOOx30.DLL 
  142.        Rename other DLLs 
  143.        Handle SYS2070 runtime errors 
  144.  
  145.  
  146. ΓòÉΓòÉΓòÉ 1.4.1. 1.0 Open a refence response file ΓòÉΓòÉΓòÉ
  147.  
  148. From the File Menu, OPEN a response file to work with. The .obj module names of 
  149. that file will be displayed in the reference listbox. The target listbox will 
  150. show the related indexes. This is to maintain the link order for best 
  151. performance (recommended in the books). The appropriate definition file will be 
  152. searched for. If not in the same directory as the .rsp file, processing is 
  153. stopped here. 
  154.  
  155. Note:  If you do not know which DLLs your appliction needs, run DLLRNAME from a 
  156. command line and inspect the ouput. 
  157.  
  158. EXAMPLE:
  159.          DLLRNAME myapp.exe
  160.  
  161. The DLL names will be shown (among other referenced libraries). For example, if 
  162. you find CPPOOB3.DLL in the list, you need CPPOOB3.RSP to open. 
  163.  
  164.  
  165. ΓòÉΓòÉΓòÉ 1.4.2. 2.0 Select items to copy ΓòÉΓòÉΓòÉ
  166.  
  167. To select items from the reference listbox: 
  168.  
  169.      Select a single item (click) or 
  170.      Select a range of items (use the search dialog from the toolbar) or 
  171.      Select a group of items by first checking the group option in the OPTIONS 
  172.       menu. 
  173.  
  174.  Searches are done for prefix or full name only. 
  175.  
  176.  A group is considered to be a modulename appended with a number, such as 
  177.  IRESLIB0.OBJ to IRESLIB4.OBJ, for example. 
  178.  
  179.  Note:  A successful search does not want selected items in the box, copy or 
  180.  deselect before the next search. 
  181.  
  182.  HELPER: If you do not know which items to select, Doubleclick Right on an 
  183.  item. The classes supported by that object module will be displayed. However, 
  184.  this is only true if the selected name appears in the class-to-header 
  185.  reference of the 'Open Class Reference' book. 
  186.  
  187.  Note:  There are more .obj modules than .hpp files. 
  188.  
  189.  
  190. ΓòÉΓòÉΓòÉ 1.4.3. 2.1 Copy Items ΓòÉΓòÉΓòÉ
  191.  
  192. Click 'COPY' on the toolbar. A listbox within a dialog appears with all the 
  193. candidates for copy. 
  194.  
  195. Note:  In this box, you may find more module names than previously selected. 
  196. The program follows the whole tree for the selected item and selects all 
  197. referenced names. Uncheck 'SEARCH TREE' in the Options Menu to disable this 
  198. feature. 
  199.  
  200. Although you can deselect items you do not want to be copied, this is not 
  201. recommended for normal composition. All items are found to be referenced by a 
  202. module within the tree and thus really needed. 
  203.  
  204. Click 'CANCEL' to end the operation or 'OK' to proceed. Selected items will be 
  205. moved to the target, replacing the appropriate indices. 
  206.  
  207.  
  208. ΓòÉΓòÉΓòÉ 1.4.4. 2.2 Delete Items ΓòÉΓòÉΓòÉ
  209.  
  210. Use the select options described in step 2.0 to select items to delete from the 
  211. target box. After clicking 'DELETE' on the toolbar, the dialog already 
  212. described under 2.1 appears. Proceed as indicated there. Selected items will be 
  213. deleted from the target and replaced by the appropriate indices. 
  214. Do not delete DDE4UDLL, this is always required for the entrypoint. 
  215.  
  216. Note:  For Delete, only directly referenced items are shown in the dialog box 
  217. instead of the whole tree. 
  218.  
  219. You cannot delete items from the reference box. 
  220.  
  221.  
  222. ΓòÉΓòÉΓòÉ 1.4.5. 2.3 Proceed with copy/delete ΓòÉΓòÉΓòÉ
  223.  
  224. Proceed with steps 2.0 to 2.2 until you think you've all done. 
  225.  
  226.  
  227. ΓòÉΓòÉΓòÉ 1.4.6. 2.4 Create a new definition file ΓòÉΓòÉΓòÉ
  228.  
  229. Click on 'MAK DEF' on the toolbar. Enter the pathnames to the .OBJS and .LIBS 
  230. files and the prefix of your target DLL name into the dialog. This prefix is 
  231. used also for the new .RSP, .DEF, .MAP, .RST(restart), and .OUT(output) files. 
  232. If the length of the name entered does not match the length of the original DLL 
  233. name, a warning is given. You may reply with 'OK' for testing, but need to 
  234. enter a name of equal lenght to later run DLLRNAME successfully. 
  235.  
  236. Note:  DLLRNAME requires names of the same length. 
  237.  
  238. Check the 'MAP'-checkbox if you want a map. 
  239.  
  240. Click 'OK' to proceed. 
  241.  
  242. A single listbox with the new and completed response file will appear. This is 
  243. only for reference and cannot be modified. The new definition file is created, 
  244. but not shown. 
  245.  
  246.  
  247. ΓòÉΓòÉΓòÉ 1.4.7. 2.5 Link the new DLL file ΓòÉΓòÉΓòÉ
  248.  
  249. Click 'LINK DLL' on the toolbar. The ICC linker is called with the new response 
  250. and definition file as input to link the new DLL. 
  251. After termination, a message box is shown with the return code passed. Click 
  252. 'OK' to continue. 
  253.  
  254.  
  255. ΓòÉΓòÉΓòÉ 1.4.8. 2.6 Inspecting Output ΓòÉΓòÉΓòÉ
  256.  
  257. If you want to see the output of the link step, click 'OUT' on the toolbar. You 
  258. will see the output from the linker. Don't worry if you see plenty of errors, 
  259. they may be based on missing only a few modules. Mainly, you will see LNK2022 
  260. (export undefined) and LNK2029 (unresolved external references) messages. 
  261.  
  262.  
  263. ΓòÉΓòÉΓòÉ 1.4.9. 2.7 Help for LNKXXXX Messages ΓòÉΓòÉΓòÉ
  264.  
  265. Getting this error messages indicates that one or more objects modules are 
  266. missing. You may search for the module name associated with the function name 
  267. in the message. Select a part or a whole phrase and doubleclick right. If 
  268. found, the corresponding references to object modules will be displayed. 
  269.  
  270. LNK2022 - export undefined 
  271. Up to the changes introduced by the CTx306 package, function names in this 
  272. message were listed in mangled format. Try to select a meaningful part of the 
  273. mangled names for the search. 
  274.  
  275. Note:  The longer the selected phrase, the greater the chance to hit the right 
  276. object module, the shorter the search time. 
  277.  
  278. LNK2029 - unresolved external reference 
  279. Try to mark a complete class member function name, but avoid to hit the quotes. 
  280. You may check first if the object module that causes the message is really 
  281. required. 
  282.  
  283. Note:  In this case, the search stops after the first match, which is usually 
  284. the needed one. 
  285.  
  286. LNK4038 - program has no starting address 
  287. If you get this message, you deleted DDE4UDLL.OBJ, the entrypoint module. This 
  288. could also result in linker abending(?) with SYS3175 after LNK4001. 
  289.  
  290.  
  291. ΓòÉΓòÉΓòÉ 1.4.10. 2.8 Restart after Errors ΓòÉΓòÉΓòÉ
  292.  
  293. If you got errors and were notified of missing modules, select 'RESTART' from 
  294. the toolbar. The target listbox will be restored and the appropriate response 
  295. file will be loaded again. You may now proceed from step 2.0 to complete your 
  296. response file. Use the search dialog to find the files. 
  297. Repeat steps 2.0 to 2.5 until you got a zero return code in 2.5. Several passes 
  298. may be necessary. 
  299.  
  300.  
  301. ΓòÉΓòÉΓòÉ 1.4.11. 2.9 Saving your work ΓòÉΓòÉΓòÉ
  302.  
  303. At any time after having modified the target you may 'SAVE' (from the file 
  304. menu) the current status of the project. Doing just 'Save' will save the status 
  305. under (dllname).RST if (dllname) is already known. Otherwise, the 'SAVEAS' 
  306. dialog will be entered. 'SaveAs' will accept any name for the restart file. 
  307. 'Save' is also called if you quit the program and the contents of the target 
  308. box has changed. 
  309.  
  310.  
  311. ΓòÉΓòÉΓòÉ 1.4.12. 2.10 Restart from a file ΓòÉΓòÉΓòÉ
  312.  
  313. To restart from a file, select 'RESTART' from the file menu. The listboxes will 
  314. be filled as after step 2.1, and you may proceed from there. The output button 
  315. will be active in order to inspect the last result of the link step. 
  316.  
  317.  
  318. ΓòÉΓòÉΓòÉ 1.4.13. 2.11 Repeat for other DLLs ΓòÉΓòÉΓòÉ
  319.  
  320. Once you finished step 2.5 with RC0, you got a DLL (almost) ready to run. 
  321. Repeat the sequence if you need to modify other DLLs. 
  322.  
  323.  
  324. ΓòÉΓòÉΓòÉ 1.4.14. 3.0 Rename DLL Names in your .exe and .dll modules ΓòÉΓòÉΓòÉ
  325.  
  326. You must tell your application files (.EXE and .DLL) about the new DLL names. 
  327.  
  328.  
  329. ΓòÉΓòÉΓòÉ 1.4.15. 3.1 Copy and Rename CPPOOS30/CPPOOM30.DLL ΓòÉΓòÉΓòÉ
  330.  
  331. First you need to copy and rename the standard libraries, CPPOOS30.DLL for 
  332. single thread, or CPPOOM30.DLL for multithread apps. These are the C++ runtime 
  333. DLLs and always needed. 
  334. This has to be done from a command line. 
  335.  
  336. EXAMPLE:
  337.        copy x:\ibmcpp\dll\CPPOM30.DLL y:\...(the current directory)
  338.        DLLRNAME CPPOOM30.DLL CPPOM30=NEWOM30         rename the file
  339.        DLLRNAME myapp.exe mydll.dll CPPOM30=NEWOM30  rename the name
  340.  
  341. where myapp is your application name, mydll your application dll (if you made 
  342. one using a class name function), and NEWOM30 the new name of the runtime DLL. 
  343.  
  344.  
  345. ΓòÉΓòÉΓòÉ 1.4.16. 3.2 Rename other DLLs ΓòÉΓòÉΓòÉ
  346.  
  347. Rename one ore more DLL names in your application 
  348.  
  349. EXAMPLE:
  350.          DLLRNAME myapp.exe mydll.dll CPPOOB3=NEWB3DL CPPOOU3=NEWU3DL
  351.          DLLRNAME myapp.exe mydll.dll CPPOOB3=NEWB3DL CPPOOU3=NEWU3DL
  352.  
  353. where myapp is your application name, mydll your application dll (if you made 
  354. one using a class name function), NEWB3DL and NEWU3DL your new runtime DLL 
  355. names. 
  356.  
  357.  
  358. ΓòÉΓòÉΓòÉ 1.4.17. 4.0 Test your application. ΓòÉΓòÉΓòÉ
  359.  
  360. When running your application, you may happen to see SYS2070 errors with an 
  361. error message like NEWU3DLL.NEWU3DLL->xxxx. This happens when a certain export 
  362. is missing in your new dll. The xxxx is the ordinal number of this export 
  363. within the referenced definition file. 
  364.  
  365.  
  366. ΓòÉΓòÉΓòÉ 1.4.18. 4.1 Handle SYS2070 Runtime Errors ΓòÉΓòÉΓòÉ
  367.  
  368. If you see SYS2070 errors when running your program, you need to search for the 
  369. ordinals. Proceed as folllows: 
  370.  
  371.      Do a 'RESTART' from the toolbar or file menu and select the failing .RST 
  372.       file. 
  373.      Select 'SEARCH ORDINAL' from the file menu. 
  374.      Enter the number to search for and 'OK'. 
  375.  
  376.  A messagebox with the search result will appear with the name of the missing 
  377.  object module. Take this name and restart as in step 2.8 or 2.10. 
  378.  
  379.  Repeat step 4.0 and 4.1 until no more error messages. Skip step 3.0 if done 
  380.  once. 
  381.  
  382.  Note:  You should test all functions of your program, because the missing 
  383.  exports are not detected until the function executes. 
  384.  
  385.  
  386. ΓòÉΓòÉΓòÉ 1.5. Comments ΓòÉΓòÉΓòÉ
  387.  
  388. You may find all this still annoying, but if you have ever done all this before 
  389. with an editor and in command mode, you will discover that using this program 
  390. is much more comfortable, even if you decide to remove only the object module 
  391. names recommended in the book.