Problem with BRepTools::Read

Hi,

I have a problem with BRepTools::Read using an istream:
The following line works perfect. So far so good.

TopoDS_Shape ashape;
BRep_Builder B1;
Standard_Boolean result = BRepTools::Read(ashape,"D:/test/edge.brep",B1);

I copied the follwing lines from the code of BRepTools::Read

BRep_Builder B;
filebuf fb;
istream in(&fb);
fb.open("D:/test/edge.brep", ios::in)

BRepTools_ShapeSet SS(B);
SS.SetProgress(NULL);
SS.Read(in);

Ang here the function crashes at SS.Read. I even cant examine wich kind of exception is thrown. I tried it with several brep files, always the same result.
I can´t understand the reason, because both cases use the same functions.

Any help would be apreciated

Regards,
Joachim

Göran Barz's picture

Did you compile your Project with the same compiler the Open Cascade Library has been built with?
Passing an istream to a library which has been built with another compiler-version of the c++-library can cause a problem.

Joachim Greiner's picture

Thanks for that hint. You might be right! My Project is compiled with VS11 but the OCC library is still a VS9 compilation. I will check that!

Joachim Greiner's picture

using the same Compiler finaly solved the problem! Thanks!