COMPAT.TXT - Compatibility Information (C) Copyright 1995 by Borland International Contents: ======== Using ObjectWindows 1.0 with Borland C++ 4.5 Downloading OWL1.PAK Using Turbo Assembler 4.0 with Borland C++ 4.5 Using the Object Based Class Library with Borland C++ 4.5 Using Turbo Vision 1.0x with Borland C++ 4.5 Using the Paradox Engine and Database Frameworks with BC 4.5 Using ObjectWindows 1.0 with Borland C++ 4.5 ============================================ The ObjectWindows 1.0 library can be built with Borland C++ 4.5 for developing OWL 1.0 native applications. With the increased capacity of the Borland tools as compared to Borland C++ 3.1, you can now use OWL libraries with full symbolic debug information and debug your application in either the Integrated Development Environment or in Tubro Debugger for Windows. The overall process requires modifying ObjectWindows source files and rebuilding the object-based container library as well as ObjectWindows. All necessary files are contained in OWL1.PAK which is on the Borland C++ compact disk in the \bc45\install directory. If you obtained Borland C++ on 5-1/4" disks instead of compact disk, you will need to download OWL1.PAK from Borland's ftp site, local bulletin board, or CompuServe. (See "Downloading OWL1.PAK".) To begin the process, copy OWL1.PAK to the \bc45 directory and use unpaq.exe (in the \bc45 directory) to extract the files. When using unpaq, be sure to set: Restore directories: checked Archive name: \bc45\owl1.pak Destination dir: \bc45 Next, select Open archive. By default, all files are selected and if you de-select any, they will not be installed. Now select Decompress. Building and using ObjectWindows and the object-based container library are described in 1OWL45.TXT which you will now find in the directory \bc45\source\owl1. Downloading OWL1.PAK ==================== OWL1.PAK can be obtained from the following sources: Borland's anonymous ftp site: ftp.borland.com CompuServe: !go BCPPWin and look in library 2. Borland's Download Bulletin: The DLBBS can be dialed at 408-431-5096. Simply join the C++ Conference (number 12). And from the File menu, select download and enter OWL1.PAK (you do not need to be in the specific file area). Using Turbo Assembler 4.0 with Borland C++ 4.5 ============================================== Turbo Assembler 4.0 is fully compatible with Borland C++ 4.5. There is an error in the WHEREIS example program which will cause two undefined symbol errors when built. The following corrections will resolve the problem: In file \examples\tasm\whereis\iexedos.asm line 118, change: mov es,[es:psp.EnvironmentBlock] to: mov es,[es:Psp.EnvironmentBlock] line 196, change: mov ax, [ComSpecSeg] to: mov ax, [ComspecSeg] In file \examples\tasm\whereis\whereis.asm line 448, change: endp main to: endp Main line 565, change: call WriteAsciizString,ds,offset Syntax to: call WriteASCIIZString,ds,offset Syntax Using the Object Based Class Library with Borland C++ 4.5 ========================================================= The object based class library, while still included with Borland C++ 4.5, must be compiled before it can be used. Here are instructions for doing so: There is a makefile in the source directory, \BC45\SOURCE\CLASSLIB which can be used to build all versions of the class library. For example, to build a large model static version for use with Object Windows, run the following command: MAKE -DDOS -DOBJECTS "-DBCC=bcc -x-" -DMODEL=l -DNAME=tclassl To build a debugging dynamic version of the class library DLL, run the following command: MAKE -DDOS -DDBG -DOBJECTS "-DBCC=bcc -x-" -DDLL -DNAME=tclass Note that to successfully use the DLL version of the class library you will have to copy TCLASS40.DLL from the \BC45\LIB directory into the \BC45\BIN directory. Using Turbo Vision 1.0x with Borland C++ 4.5 ============================================ REBUILDING THE TURBO VISION LIBRARY: Due to changes in the debug information format, symbol length, and runtime library, the Turbo Vision 1.0 library must be recompiled with Borland C++ 4.5. Note that Turbo Vision 2.0 is fully compatible with Borland C++ 4.5 and does not require the modifications in this section. There are a few minor changes that need to be made to the source code before recompiling it with the new compiler. These are due to slightly tightened syntax restrictions. The makefile will require some modification as well, which are shown below. There are 3 steps to this process: 1. Copy the old 3.1 Turbo Vision source into the new BC45 directory structure. 2. Make the appropriate changes according to the instructions below. 3. Run MAKE to build the new Turbo Vision library you need to continue your work. If you are using Turbo Vision in an overlaid application, make sure you follow the instructions specific to overlays. These steps are now presented in more detail: Note that the Borland C++ root directory is assumed to be \BC45. Change this as necessary for your particular installation. Also, if you are upgrading from Borland C++ 2.0 and have the original version of Turbo Vision, some of the line numbers mentioned may not accurately reflect your version. You need to copy your old Turbo Vision source and include files from Borland C++ 3.1 into your Borland C++ 4.5 directory hierarchy. To do this, just run the following command: XCOPY \BC31\TVISION \BC45\TVISION /S and when it asks you about creating a directory called TVISION, say yes. Modify the above paths according to your system configuration if necessary. You are now ready to make the necessary modifications before rebuilding the library. The changes are as follows: 1. Due to tighter syntax checking, case blocks that declare initialized local variables need their own scoping block. Make the changes below in the order shown so that confusion over the correct line numbers can be avoided. In general, the '{' follows a case statement, and the '}' follows a break statement. COLORSEL.CPP Add after line 219: } Add after line 179: { Add after line 177: } Add after line 164: { TBUTTON.CPP Add after line 226: } Add after line 211: { Add after line 209: } Add after line 192: { 2. TINPUTLIN.CPP Replace line 44: if( (p = strchr( s, '~' )) != 0 ) With if( (p = (char*) strchr( s, '~' )) != 0) 3. TMNUVIEW.CPP Replace line 348: char *loc = strchr( p->name, '~' ); With char *loc = (char*)strchr( p->name, '~' ); 4. TVWRITE.ASM Replace line 25: PUBLIC @TView@writeChar$qsszcucs With PUBLIC @TView@writeChar$qsscucs Replace line 27: PUBLIC @TView@writeStr$qssnxzcuc With PUBLIC @TView@writeStr$qssnxcuc Replace line 366: PROC @TView@writeChar$qsszcucs With PROC @TView@writeChar$qsscucs Replace line 436: PROC @TView@writeStr$qssnxzcuc With PROC @TView@writeStr$qssnxcuc Note that all of the above changes simply entail removing the letter 'z' from the last part of the mangled symbol name. 5. MAKEFILE Replace line 100: CFLAGS = -c $(CCOVYFLAGS) -P -O1 -m$(MODEL) -I$(INCLUDE) -n$(OBJDIR) With CFLAGS = -c -x- $(CCOVYFLAGS) -P -O1 -m$(MODEL) -I$(INCLUDE) -n$(OBJDIR) Replace line 73: TLIB = $(BCROOT)\bin\tlib /0 With this group of 5 lines: !ifdef DEBUG TLIB = $(BCROOT)\bin\tlib !else TLIB = $(BCROOT)\bin\tlib /0 !endif *** If you did NOT purchase the Turbo Assembler add-on package for Borland C++ 4.5, you must make some additional changes. Replace the group at lines 259-263: !if $d(BC) $(TASM) $&.asm, $(OBJDIR)\$&.obj !else copy $(TVLIBDIR)\$&.obj $(OBJDIR) !endif With this group: !if !$d(NOTASM) $(TASM) $&.asm, $(OBJDIR)\$&.obj !else copy $(LIBDIR)\COMPAT\$&.obj $(OBJDIR) !endif Add after line 49: NOTASM = 1 USE OF EXCEPTION HANDLING WITH TURBO VISION: Turbo Vision was designed with its own global new operator. Due to this internal design you will not be able to use exception handling with the new operator. However, any other type of exception handling is supported. In order to enable exception handling do not make the change to line 88 of the makefile. USE OF OVERLAYS WITH TURBO VISION: ** Note: All instructions in this section are in addition to the changes recommended above. As with Borland C++ 3.1, Turbo Vision can be used in an overlayed program if the library is rebuild with certain options, shown below: All overlayed modules must be compiled with local virtual tables (-Vs). Overlayed modules no longer need to be compiled via assembler (-B). Overlayed modules must be compiled with exceptions disabled (-x-). Here are the steps required to build an overlayable version of TV.LIB: 1. First make an additional change to file TVISION\SOURCE\MAKEFILE: Change line 96 from : CCOVYFLAGS = -Y -Vs -B to : CCOVYFLAGS = -Y -Vs 2. Change to the \BC45\TVISION\LIB directory and make a backup copy of TV.LIB by typing: COPY TV.LIB OLDTV.LIB 3. Switch to the \BC45\TVISION\SOURCE directory and type: MAKE -B -DOVERLAY 4. This will create a new TV.LIB in the \BC45\TVISION\LIB directory. There are seven modules in TV.LIB which cannot be overlayed. The easiest solution to this problem is to create three seperate libraries. Two libraries will be used when creating overlayed TV apps, and the original TV.LIB will remain for use in non-overlayed TV apps: TV.LIB - full TV lib for use in non-overlayed TV apps TVO.LIB - overlayable modules of TV.LIB TVNO.LIB - non-overlayable modules of TV.LIB To create these libraries, switch into the TVISION\LIB directory and type the following commands: TLIB TV.LIB -*SYSERR -*TSCREEN -*DRIVERS -*DRIVERS2 -*SWAPST -*TEVENT -*SYSINT TLIB TVNO.LIB +SYSERR +TSCREEN +DRIVERS +DRIVERS2 +SWAPST +TEVENT +SYSINT RENAME TV.LIB TVO.LIB RENAME TVOLD.LIB TV.LIB DEL *.OBJ *.BAK 5. You will now have the three libraries. To create an overlayed Turbo Vision application, include both TVO.LIB and TVNO.LIB in the project file or link line of the makefile. Using the local options for each item, mark TVO.LIB as overlayed and TVNO.LIB as non-overlayed. Also, go to the TargetExpert dialog box for this target and uncheck the Turbo Vision Library. Using the Paradox Engine And Database Frameworks with BC 4.5 ============================================================ THE PARADOX ENGINE There is only one significant detail regarding the use of the Paradox Engine 3.0x with Borland C++ 4.5. The BC 3.1 versions of setjump and longjump will have to be linked into your application in order to create DOS Paradox Engine and Database Framework applications. The object module, setjmp.obj, is provided in the BC45\LIB\COMPAT directory. Linking this module into your application will replace the BC 4.5 version of these functions. To do this, simply add the file \BC45\LIB\COMPAT\SETJMP.OBJ to your project file or to the link command in your makefile. REBUILDING THE DATABASE FRAMEWORKS Due to changes in the debug information format, symbol length, and runtime library, the Database Framework library must be recompiled with Borland C++ 4.5. A number of changes will have to be made to the Paradox Engine DBF v3.01 makefile in order for it to work with BC 4.5 (this makefile is available from our local BBS at (408) 431-5096 as the file TI1169.ZIP and from TechFax at (800) 822-4269, document number 1169): 1. Copy makefile.bc to make40.mak 2. Make certain that a turboc.cfg file exists in the BC45\BIN directory containing: -Ic:\bc45\include -Lc:\bc45\lib Make certain that a tlink.cfg file exist in the BC45\BIN directory containing: -Lc:\bc45\lib Adjust the above paths to reflect your systems' configuration. 3. Make the following changes: Line 83: Change the 'CCINCLUDE=' line to contain the path to the BC 4.5 include directory. Line 168: Delete the blank space at the end of the 'DEBUGFLAG=v ' line Line 172: Delete the blank space at the end of the 'DYNAMICFLAG=d ' line Line 202: Add '-DWindows' after '-DWINDOWS' Line 204: Add '-DWindows' after '-DWINDOWS' Line 206: Add '-DWindows' after '-DWINDOWS' Line 239: Replace '$D' with 'BuildDir' Line 249: Replace '$D' with 'BuildDir' Line 261: Replace '$D' with 'BuildDir' Then use the following command to create a Database Framework Library. Add one or both of the options -DDBG and -DWINDOWS to add debug info or build for use in WINDOWS code. (Refer to the makefile for even more options.) make -fmake40.mak For example, the following command will create a large model, static windows DBF library with debug info: make -DWINDOWS -DDBG -fmake40.mak The libraries will be created in the PXENG30\C\LIB directory. These libraries are now ready for use in your Database Frameworks Program. CHANGES TO USER CODE WITH RESPECT TO DBF The only change to your source code involves the use of the 'new' operator. In BC++ 4.5, the new operator no longer returns NULL in case of failure, rather the xalloc exception is thrown. To change this back so operator new returns NULL, call set_new_handler(0). The only remaining issue is with using the new operator in the constructor of global objects. How do you call set_new_handler(0) before a global object's constructor is called? This is accomplished by using a #pragma startup function with a priority higher than that of the startup function used to call the particular global object's constructor. The following code shows an example of changing the behavior of new: #include void old_new(void) { set_new_handler(0); } #pragma startup old_new 31 BEngine eng(pxWin); int main (void) { . . . return 0; } Note that creating global instances of Database Framework objects is not recommended because it can make error checking difficult. The other option is to change the source of the Database Frameworks: Add the try {} catch(xalloc) clause everywhere that new is called.