How to setup old Borland C for use with eComStation Toolkit

By Anakor

Introduction
Back in 1994 Borland International had released the last version 2.0 of their Borland C++ for OS/2 compiler. It came with OS/2 2.0 header files and documentation. That seems to be very outdated.

In my opinion the Borland compiler is a good compiler for beginners or small projects. It has a nice GUI and the great Resource Workshop. But we have to deal with these problems: But believe it or not, where there's a will there's a way.
 * 1) First, the headers had no knowledge about MMOS2, so it isn't possible to use any of the MMOS2 Functions with the original files.
 * 2) Second, IBM had changed several things in the header files back in Warp 4 days. Since then, the Borland Compiler isn't supported any more in the headers.

Installing the Toolkit
Our first step to get these working, is to install the toolkit from the eComStation 1.1 Disk 2. The Toolkit comes with an install program so this thread is pretty simple. After install and reboot is done, your config.sys will be supplied with various SET statements and other stuff.

For those of you don't want to mess up the config.sys and favour a small installation I recommend to not use the supplied tkinst program. Instead you should simply copy the required files by hand to a directory of your choice. You should proceed through following steps:

1. Create a directory tree to place the toolkit files in: toolkit ──┐ h          book help ipfc bin Create this tree by hand on your HD. We don't need any other directories.

2. Copy all files and directories available in \h from your toolkit source to your previously created directory \h.

3. Copy all online book files available in \book from your toolkit source to \book. This is only the documentation, so this isn't a must.

4. Copy all files available in \ipfc from your toolkit source to \ipfc. These are help compiler files, so it is required only if you want create help files using the IPF compiler.

5. Copy ipfc.exe in \bin from your toolkit source to \bin. The ipfc executable is required only if you want create help files.

6. Check and/or edit your config.sys. Make sure these settings are available and working: SET HELP=\Help;%HELP% SET BOOKSHELF=\BOOK;%BOOKSHELF% SET HELPNDX=EPMKWHLP.NDX;%HELPNDX% SET IPFC=\IPFC;%IPFC% SET CPREF=CP1.INF+CP2.INF+CP3.INF SET GPIREF=GPI1.INF+GPI2.INF+GPI3.INF+GPI4.INF SET MMREF=MMREF1.INF+MMREF2.INF+MMREF3.INF SET PMREF=PM1.INF+PM2.INF+PM3.INF+PM4.INF+PM5.INF SET WPSREF=WPS1.INF+WPS2.INF+WPS3.INF SET PATH=\Bin;%PATH% After this all applied and system is rebooted the toolkit files are ready to work with.

Installing the BCOS2-Compiler
The original Borland for OS/2 CD-ROM or disks came with an install application. Run it and install the compiler normally. But don't let the Operating System reboot.

After the install program terminates, go to your config.sys and remove all settings which the install program has applied there. Especially look for the settings: libpath= \bin SET IPFC= \ipfc SET BOOKSHELF= \bin SET HELP= \bin If these statements are at the end of your config.sys it will overwrite our statements from the previous chapter. Instead of these modifications you should apply this setting: SET PATH= \bin

If you consider the use of the Borland GUI controls (required by Resource Workshop), copy the required DLL from \bin\bpmcc.dll to :\ecs\dll\bpmcc.dll. In this case all applications wanting this DLL will have it.

After this modifications are made, reboot your machine.

Modifications on Borland C/C++ and the Toolkit
If you compile a program using BCOS2 the compiler links/binds libraries with your own executable file. But the compiler only has the outdated OS/2 2.0 library, so we need to replace it with something. The file to replace is \lib\os2.lib. The needed files are included in the toolkit\lib directory on the eComStation 1.1 disk 2.

So you have to copy toolkit\lib\os2386.lib to \lib\os2.lib.

If you want bind MMOS2 functions as well, you have to copy toolkit\lib\mmos2.lib to \lib\mmos2.lib.

Do so for any library you want to link/bind with your program.

To prevent collision between toolkit headers with Borland headers, I recommend to delete or move all headers from the \include directory that already is in \h.

Make a filename compare and remove them!

As I stated in the first chapter, IBM has removed Borland support from the header files in 1995/1996. To get the toolkit headers working with BCOS2 again, we have to edit the file \h\os2def.h.

The original os2def.h looks like this: /* NOINC */
 * 1) define FAR        /* this will be deleted shortly */
 * 2) define NEAR       /* this will be deleted shortly */
 * 3) define APIENTRY   _System
 * 4) define EXPENTRY   _System
 * 5) define APIENTRY16 _Far16 _Pascal
 * 6) define PASCAL16   _Far16 _Pascal
 * 7) define CDECL16    _Far16 _Cdecl
 * 8) define VOID       void

The modified os2def.h should look like this: /* NOINC */
 * 1) define FAR        /* this will be deleted shortly */
 * 2) define NEAR       /* this will be deleted shortly */
 * 1) if defined(__IBMC__) || defined(__IBMCPP__)
 * 2) define APIENTRY   _System
 * 3) define EXPENTRY   _System
 * 4) endif
 * 1) if defined(__BORLANDC__)
 * 2) define _Far16     _far16
 * 3) define _Pascal    _pascal
 * 4) define APIENTRY   __syscall
 * 5) define EXPENTRY   __syscall
 * 6) define FAR16PTR   _Far16 *
 * 7) define _Seg16
 * 8) endif
 * 1) define APIENTRY16 _Far16 _Pascal
 * 2) define PASCAL16   _Far16 _Pascal
 * 3) define CDECL16    _Far16 _Cdecl
 * 1) define VOID       void

Conclusion
To test the installation, we have to create a project file with our sources. As you see in the image the paths are set to both, the toolkit and the BCOS2 resources, but the toolkit files first.

I hope this info is helpful to anybody.

Additional Information

 * C++ Compiler Review by Gordon Zeglinski