How to setup old Borland C for use with eComStation Toolkit
In my opinion the Borland compiler is a good compiler for beginners or small projects. It has a nice GUI and the great Ressource Workshop. But we have to deal with these problems:
- First, the headers had no knowledge about MMOS2, so it isn't possible to use any of the MMOS2 Functions with the original files.
- Second, IBM had changed several things in the header files back in Warp 4 days. Since then, the Borland Compiler isn't supported anymore in the headers.
But believe it or not, where there's a will there's a way.
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 programm 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 favor 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 <source>\h from your toolkit source to your previously created directory <toolkit>\h.
3. Copy all Onlinebook files available in <source>\book from your toolkit source to <toolkit>\book. This is only the documentation, so this isn't a must.
4. Copy all files available in <source>\ipfc from your toolkit source to <toolkit>\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 <source>\bin from your toolkit source to <toolkit>\bin. The ipfc executeable is required only if you want create help files.
6. Check and/or edit your config.sys. Make shure these settings are available and working:
SET HELP=<Toolkit>\Help;%HELP% SET BOOKSHELF=<Toolkit>\BOOK;%BOOKSHELF% SET HELPNDX=EPMKWHLP.NDX;%HELPNDX% SET IPFC=<Toolkit>\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=<Toolkit>\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=<bcos2>\bin SET IPFC=<bcos2>\ipfc SET BOOKSHELF=<bcos2>\bin SET HELP=<bcos2>\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:
If you consider the use of the Borland GUI controls (required by Ressource Workshop), copy the required DLL from <bcos2>\bin\bpmcc.dll to <bootdrive>:\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 executeable 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 <bcos2>\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 <bcos2>\lib\os2.lib.
If you want bind MMOS2 functions as well, you have to copy toolkit\lib\mmos2.lib to <bcos2>\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 <bcos2>\include directory that already is in <toolkit>\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 <toolkit>\h\os2def.h.
The original os2def.h looks like this:
/* NOINC */ #define FAR /* this will be deleted shortly */ #define NEAR /* this will be deleted shortly */ #define APIENTRY _System #define EXPENTRY _System #define APIENTRY16 _Far16 _Pascal #define PASCAL16 _Far16 _Pascal #define CDECL16 _Far16 _Cdecl #define VOID void
The modified os2def.h should look like this:
/* NOINC */ #define FAR /* this will be deleted shortly */ #define NEAR /* this will be deleted shortly */ #if defined(__IBMC__) || defined(__IBMCPP__) #define APIENTRY _System #define EXPENTRY _System #endif #if defined(__BORLANDC__) #define _Far16 _far16 #define _Pascal _pascal #define APIENTRY __syscall #define EXPENTRY __syscall #define FAR16PTR _Far16 * #define _Seg16 #endif #define APIENTRY16 _Far16 _Pascal #define PASCAL16 _Far16 _Pascal #define CDECL16 _Far16 _Cdecl #define VOID void
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 ressources, but the toolkit files first.
I hope this info is helpful to anybody.
- C++ Compiler Review by Gordon Zeglinski