Difference between revisions of "How to setup old Borland C for use with eComStation Toolkit"

From EDM2
Jump to: navigation, search
m (Installing the Toolkit)
m (Modifications on Borland C/C++ and the Toolkit)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
By [[Anakor]]
 
By [[Anakor]]
  
== Introduction ==
+
==Introduction==
 +
Back in 1994 [[Borland|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.
  
Back in 1994 Borland Int. had released the last version 2.0 of their Borland C/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:
 +
#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 any more in the headers.
 +
But believe it or not, where there's a will, there's a way.
  
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:
+
==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.
  
First, the headers had no knowledge about MMOS2, so it isn't possible to use any of the MMOS2 Functions with the original files.
+
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 the following steps:
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:
 
1. Create a directory tree to place the toolkit files in:
 
 
  toolkit ──┐
 
  toolkit ──┐
 
           h
 
           h
Line 26: Line 21:
 
           ipfc
 
           ipfc
 
           bin
 
           bin
 
 
Create this tree by hand on your HD. We don't need any other directories.
 
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.
+
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.
+
3. Copy all online book 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.
+
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 to 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.
+
5. Copy ipfc.exe in <source>\bin from your toolkit source to <toolkit>\bin. The ipfc executable is required only if you want to create help files.
  
6. Check and/or edit your config.sys. Make shure these settings are
+
6. Check and/or edit your config.sys. Make sure these settings are available and working:
available and working:
+
SET HELP=<Toolkit>\Help;%HELP%
 
+
SET BOOKSHELF=<Toolkit>\BOOK;%BOOKSHELF%
SET HELP=<Toolkit>\Help;%HELP%<br>
+
SET HELPNDX=EPMKWHLP.NDX;%HELPNDX%
SET BOOKSHELF=<Toolkit>\BOOK;%BOOKSHELF%<br>
+
SET IPFC=<Toolkit>\IPFC;%IPFC%
SET HELPNDX=EPMKWHLP.NDX;%HELPNDX%<br>
+
SET CPREF=CP1.INF+CP2.INF+CP3.INF
SET IPFC=<Toolkit>\IPFC;%IPFC%<br>
+
SET GPIREF=GPI1.INF+GPI2.INF+GPI3.INF+GPI4.INF
SET CPREF=CP1.INF+CP2.INF+CP3.INF<br>
+
SET MMREF=MMREF1.INF+MMREF2.INF+MMREF3.INF
SET GPIREF=GPI1.INF+GPI2.INF+GPI3.INF+GPI4.INF<br>
+
SET PMREF=PM1.INF+PM2.INF+PM3.INF+PM4.INF+PM5.INF
SET MMREF=MMREF1.INF+MMREF2.INF+MMREF3.INF<br>
+
SET WPSREF=WPS1.INF+WPS2.INF+WPS3.INF
SET PMREF=PM1.INF+PM2.INF+PM3.INF+PM4.INF+PM5.INF<br>
+
SET PATH=<Toolkit>\Bin;%PATH%
SET WPSREF=WPS1.INF+WPS2.INF+WPS3.INF<br>
+
After this all applied and system is rebooted, the toolkit files are ready to work with.
SET PATH=<Toolkit>\Bin;%PATH%<br>
+
 
+
After this all applied and system is rebooted the toolkit files are ready to work with.
+
  
 
== Installing the BCOS2-Compiler ==
 
== 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.
  
<P>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.<br>
+
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:
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</P>
+
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:
 +
SET PATH=<bcos2>\bin
  
<P>'''libpath=<bcos2>\bin'''<BR>
+
If you consider the use of the Borland GUI controls (required by Resource 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.
'''SET IPFC=<bcos2>\ipfc'''<BR>
+
'''SET BOOKSHELF=<bcos2>\bin'''<BR>
+
'''SET HELP=<bcos2>\bin'''</P>
+
  
<P>If these statements are at the end of your config.sys it will overwrite our statements from the previous chapter.
+
After these modifications are made, reboot your machine.
Instead of these modifications you should apply this setting:</P>
+
  
<P>'''SET PATH=<bcos2>\bin'''</P>
+
== 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 <bcos2>\lib\os2.lib. The needed files are included in the toolkit\lib directory on the eComStation 1.1 disk 2.
  
<P>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.</P>
+
So you have to copy toolkit\lib\os2386.lib to <bcos2>\lib\os2.lib.
  
<P>After this modifications are made, reboot your machine.</P>
+
If you want to bind MMOS2 functions as well, you have to copy toolkit\lib\mmos2.lib to <bcos2>\lib\mmos2.lib.
  
== Modifications on Borland C/C++ and the Toolkit ==
+
Do so for any library you want to link/bind with your program.
  
<P>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.<BR>
+
To prevent collision between toolkit headers with Borland headers, I recommend deleting or moving all headers from the <bcos2>\include directory that already is in <toolkit>\h.
So you have to copy toolkit\lib\os2386.lib to <bcos2>\lib\os2.lib.</P>
+
  
<P>If you want bind MMOS2 functions as well, you have to copy toolkit\lib\mmos2.lib to <bcos2>\lib\mmos2.lib.<BR>
+
'''Make a filename compare and remove them!'''
Do so for any library you want to link/bind with your program.</P>
+
  
<P>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.<BR>
+
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.
'''Make a filename compare and remove them!'''</P>
+
  
<P>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.<BR><BR>
+
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 original os2def.h looks like this<BR><BR>
+
The modified os2def.h should look like this:
 
+
/* NOINC */
/* NOINC */<BR>
+
#define FAR        /* this will be deleted shortly */
<nowiki>#</nowiki>define FAR        /* this will be deleted shortly */<BR>
+
#define NEAR        /* this will be deleted shortly */
<nowiki>#</nowiki>define NEAR        /* this will be deleted shortly */<BR>
+
<nowiki>#</nowiki>define APIENTRY    _System<BR>
+
#if defined(__IBMC__) || defined(__IBMCPP__)
<nowiki>#</nowiki>define EXPENTRY    _System<BR>
+
#define APIENTRY    _System
<nowiki>#</nowiki>define APIENTRY16  _Far16 _Pascal<BR>
+
#define EXPENTRY    _System
<nowiki>#</nowiki>define PASCAL16    _Far16 _Pascal<BR>
+
#endif
<nowiki>#</nowiki>define CDECL16    _Far16 _Cdecl<BR>
+
<nowiki>#</nowiki>define VOID        void<BR>
+
#if defined(__BORLANDC__)
<BR>
+
#define _Far16      _far16
The modified os2def.h should look like this:<BR>
+
#define _Pascal    _pascal
<BR>
+
#define APIENTRY    __syscall
/* NOINC */<BR>
+
#define EXPENTRY    __syscall
<nowiki>#</nowiki>define FAR        /* this will be deleted shortly */<BR>
+
#define FAR16PTR    _Far16 *
<nowiki>#</nowiki>define NEAR        /* this will be deleted shortly */<BR>
+
#define _Seg16
<BR>
+
#endif
<nowiki>#</nowiki>if defined(__IBMC__) || defined(__IBMCPP__)<BR>
+
<nowiki>#</nowiki>define APIENTRY    _System<BR>
+
#define APIENTRY16  _Far16 _Pascal
<nowiki>#</nowiki>define EXPENTRY    _System<BR>
+
#define PASCAL16    _Far16 _Pascal
<nowiki>#</nowiki>endif<BR>
+
#define CDECL16    _Far16 _Cdecl
<BR>
+
<nowiki>#</nowiki>if defined(__BORLANDC__)<BR>
+
#define VOID        void
<nowiki>#</nowiki>define _Far16      _far16<BR>
+
<nowiki>#</nowiki>define _Pascal    _pascal<BR>
+
<nowiki>#</nowiki>define APIENTRY    __syscall<BR>
+
<nowiki>#</nowiki>define EXPENTRY    __syscall<BR>
+
<nowiki>#</nowiki>define FAR16PTR    _Far16 *<BR>
+
<nowiki>#</nowiki>define _Seg16<BR>
+
<nowiki>#</nowiki>endif<BR>
+
<BR>
+
<nowiki>#</nowiki>define APIENTRY16  _Far16 _Pascal<BR>
+
<nowiki>#</nowiki>define PASCAL16    _Far16 _Pascal<BR>
+
<nowiki>#</nowiki>define CDECL16    _Far16 _Cdecl<BR>
+
<BR>
+
<nowiki>#</nowiki>define VOID        void<BR>
+
  
 
== Conclusion ==
 
== 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.
[[Image:bcos2_dirs.png]]
+
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.
 
I hope this info is helpful to anybody.
  
 
== Additional Information ==
 
== Additional Information ==
 +
*[http://www.edm2.com/0308/compilers.html C++ Compiler Review] by Gordon Zeglinski
  
[http://www.edm2.com/0308/compilers.html C++ Compiler Review] by Gordon Zeglinski<BR>
+
[[Category:Tools Articles]]
[http://www.it-frame.de IT-Frame]<BR>
+
[http://www.anakor.de anakor.de]<BR>
+

Latest revision as of 10:58, 21 August 2022

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:

  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.

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 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 the 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 online book 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 to create help files using the IPF compiler.

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

6. Check and/or edit your config.sys. Make sure 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:

SET PATH=<bcos2>\bin

If you consider the use of the Borland GUI controls (required by Resource 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 these 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 <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 to 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 deleting or moving 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

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