Succesfull modification of OCC to support Borland

I have successfully modified and compiled OCC 6.2 for Borland Developer Studio c++ personality (Explorer edition).This brings RAD to opencascade one step further at my opinion.At the first steps everything seems to work fine (Visualization , OCAF , Modelling Algos ) with a test application i created. I Did not finish yet with the WOK and DRAW packages. Most of the work done was to create the projects , and modifying some non borland keywords (__leave), also few modification were required for some non Borland defines. I contacted the OCC team , but until now i had no response. Maybe somebody could tell which is the right way to contribute my work to OCC team.

Greetings from Greece to everyone !

QbProg's picture

Hello,
great work! If you could make it available to the public , it would be really a good thing. Did looked at the "Open Source Community" area. There you could post a new project, but you still need to get a place where to store the packages.
Integrating directly in OCC would be the best option!

QbProg

Fotis Sioutis's picture

This morning i have been contacted by OCC and i will send them all the changes on the source code , plus the project files.I do not know if they will officialy support it, anyway.Also i will put an archive on an ftp server somewhere.Your idea of creating a project on the "Open Source Community" area is great and i will proceed by doing so, as soon as i will have some spare time.

DingLi's picture

Where's your ftp address? Could you please send a link to me? It is really very exciting that Opencascade can be used on BDS.

DingLi's picture

Where's your ftp address? Could you please send a link to me? It is really very exciting that Opencascade can be used on BDS.

Fotis Sioutis's picture

Anyone who might be interested ...

OCC version 6.2 modified for BDS C++ Personality can be found at:

http://62.1.3.26/download/ros.rar

Compiles and works OK with Turbo c++ (Explorer edition) which is the one i have
and it is given for free from www.codegear.com .All the hotfixes must be applied ,
otherwise you might see some "Internal Compiler Errors".Upon extensive use of OCC
over BDS one might want to change the math error handling routine of RTL (raises domain
errors where it should not...).

Included in the archive are also all
the project files for OCC and precompiled
binaries (debug version).

Greetings from sunny greece !! :)
Sioutis Fotis

Fotis Sioutis's picture

//---------NEW VERSION AVAILABLE---------------------------
New version of the modified library can be found
at the OpenSource community -> Contributions -> Borland Port.

Contains the following modifications

1.Modified project files (corrects issues with .lib files
upon building release version of OCC.

2.Contains also release precompiled binaries.

3.Draw test harness has also been ported and precompiled.

4.Contains the modified binary RTL of Borland.

5.Contains a (small half hour created) demo application.

6.Contains a folder with the modifications required from the
original source tree.

7.Contains the 8.4.2 version of tcl/tk (as OCC team uses) for
test harness application.

With owner

Sioutis Fotis

Fotis Sioutis's picture

I have been notified by the OCC team that the package containing
OCC for Borland compiler was corrupted.Anyway i have uploaded again
the package, so anyone who tried to download without success can give
it another try.This package also contains the well known MakeBottle
example( Many thanks to Klaas Wolters for contributing his example ).
It can be compiled with any C++ BDS based edition of Codegear(Borland).
Please notice that the DRAWEXE and SAMPLE programms must be started
with their corresponding batch files in order to have environment
variables and PATH properly setup.

With owner

Sioutis Fotis

sh's picture

Hello Sioutis,
Thanks for your efforts in porting occ to bds.
It works with bds2006 but seems to have problems when I tried it with c++ builder 6. Could I have a copy of the occ6.1 for c++builder6?
Thanks a lot.
sh

Fotis Sioutis's picture

Indeed it is impossible to use OCC 6.2 for BDS with Builder 6.This is due to the
different STL implementation in the two versions.Builder 6 uses STLport, and BDS uses
dinkumware STL.I will soon upload OCC 6.1 for Builder 6 on my server and notify you
with the link.Although I strongly recommend you to use BDS cause it is more tested
and I can also provide some support on your efforts.Also with Builder 6 I have some
unresolved bugs with Streams (stl again...).
Anyway the decision is up to you...

Greetings
Sioutis Fotis

Fotis Sioutis's picture

Hello sh

Sorry for the small delay.I have uploaded OOC 6.1 for Builder 6 on my server
You can download it from the link below:

http://62.1.3.26/download/OCC_6_1_Builder_6.rar

Read first /Open Source Community/Contributions/Borland Port/
and apply the startup code at your project.In Builder 6 there
is no need to patch the RTL dll but it is a must to write
your own math error handler and treat accordingly any strange
EDOMAIN or math errors.

Greetings
Sioutis Fotis

Fotis Sioutis's picture

I have been notified by the OCC team that the package containing
OCC for Borland compiler was corrupted.Anyway i have uploaded again
the package, so anyone who tried to download without success can give
it another try.This package also contains the well known MakeBottle
example( Many thanks to Klaas Wolters for contributing his example ).
It can be compiled with any C++ BDS based edition of Codegear(Borland).
Please notice that the DRAWEXE and SAMPLE programms must be started
with their corresponding batch files in order to have environment
variables and PATH properly setup.

With owner

Sioutis Fotis

Fotis Sioutis's picture

MAJOR BUG in OCC for Borland has been solved.

Until now i had very strange behaviour whenever an exception was thrown.
It seems that the RTL calls _fpreset() , whenever any kind of exception is thrown.
This causes the FPU control word to change to 24 bit precision, and re-enables the
exception mask.The consequence of this is just a disaster !.The fix in this case is
to reprogram the default control word which is used internally at the RTL by _fpreset()
command.Code at the startup of application should be like this.

//Edit the exception mask in order to disable invalid and overflow exceptions
unsigned int A_NEW_FPU_EXCEPTION_MASK = MCW_EM;
A_NEW_FPU_EXCEPTION_MASK |= EM_INVALID;
A_NEW_FPU_EXCEPTION_MASK |= EM_OVERFLOW;

//Apply the control word to the RTL variable _default87
_default87 = RC_NEAR+PC_64+IC_AFFINE+A_NEW_FPU_EXCEPTION_MASK;

//fpreset will now use the _default87 variable to reset the FPU control word
_fpreset();

From now and on when an exception will occur then the fpreset
will set the control word to a correct value.

Also the previous fix (with the _control87 function) is not needed in case one uses this patch

With owner

Sioutis Fotios