Making a LIB

YAMP has a lot of code that goes unused in many programs. One of the ways to eliminate this code from your executables is to build a LIB. The link step only pulls in code from the library that has been called by the program. I have included a make file that builds the library using Borland's make and C++ compiler. You can fiddle with it to build your own library. Make sure to modify the directory names to conform to your system. I have also included a make file to build the three test files found in the appendices. Issue the instructions

  make -fto_lib.mak 
  make -fmaketest.mak

to make the library and test files. These will produce files that use floating point emulation, and default Borland optimizations. The library will not include debug information and the test files will include it. I had some trouble creating the libraries using the speed optimizations. The test files produce garbage even though they link without errors. The optimizations work well from the IDE though.

I also had some trouble with BCC v3.1 when trying to link to the library. I would get error messages about the contents of the lib file after it had been created. Apparently the way BCC v3.1 releases its DPMI memory corrupts the memory on my machine so the link step fails. I could reboot and the problem vanished. This problem also occured when I tried to use the makefile for some of the Borland object libraries. I had to reboot before each link. Make sure to run chkdsk if this occurs.

This problem resolved when I started using the most recent version of emm386.sys and himem.sys, which shipped with Windows 3.1.