BRepTools::Write crashes with Standard_OStream

Hi,

I did an upgrading of my projet from MS VS 2003 + OCC 5.2.0 to MS VS 2008 + OCC 6.5.0.
In that I am trying to save my work via filestream with following code:

............................
ofstream f("D:\MyApp.brep");
f f BRepTools::Write(myTopoDShape, f);
.............................

While it was working fine with VS 2003 + OCC 5.2.0, I get with VS 2008 + OCC 6.5.0 the
following failure if I execute the line with BRepTools::Write(...):

Unhandled Exception Error 0X762fb727 in myApp.exe:
Microsoft +-Exception std::bad_alloc at memory location 0x0018e2e0

An similiar solution with:
.............................
Standard_CString myFileName = "MyApp.brep";
BRepTools::Write(myTopoDShape, myFileName);
.............................
works with VS 2008 + OCC 6.5.0 well.

Any idea ?
Thanks in advance.

Roman Lygin's picture

Hi,
Are you consistently using Visual C++ run-time libraries ? 6.5.0 comes with precompiled VS2005 (vc8) binaries and if you try to use them in your VS2008 built app, you may encounter multiple issues like this. You should rebuild OCC for VS2008.

Hope this post will be helpful - http://opencascade.blogspot.com/2010/03/mixing-run-times.html.
Roman

Heinz R.'s picture

Hi Roman,

I rebuilded OCC 6.5.0 with VS 2008 SP1.

Regards