winapi - Access location 0xFFFFFFFFF crash between x64 and Win32 configuration -


i writing because having problem dlls of library using code. have looked similar threads related crashes in release mode not in debug mode not seem fit issue facing. have prepared small example shows problem. using visual studio 2010 compile example open cascade library.

the problem when compile , run example in release x64 configuration, creation of brepoffsetapi_makepipe object makes application crash because of crash in tkbrep.dll due access reading location 0xffffffffffff. bit puzzling if code compiled in release win32, works fine , result correct. hereafter describe process following compile library , code have written. please, note objects create (i.e. cylinder, faces) created using classes of occ. using version 6.8.0 have observed same problem version 6.9.0. reason, prone think problem in code writing.

process install occ win32 , x64 configuration.

  1. download occ 6.8.0 windows installer , install library. result in installed win32 libraries , dlls.
  2. open occ.sln in visual studio 2013 , compile packages needed example in release x64 configuration. create libraries , dlls in win64 folder within installation folder.

example code:

void constructwires(gp_pnt pointzero, gp_pnt pointone,    topods_wire& circular, topods_wire& straight,    topods_face& facecircular) {    brepbuilderapi_makeedge edges(pointzero, pointone);    edges.build(); edges.check();     brepbuilderapi_makewire wires(edges.edge());    wires.build(); wires.check();     straight = wires.wire();     gp_vec vec(pointzero.x() - pointone.x(), pointzero.y() - pointone.y(), pointzero.z() - pointone.z());    gp_dir dir = vec.normalized();     gp_ax2 ax(pointzero, dir);    handle(geom_circle) circle = new geom_circle(ax, 50.0);     brepbuilderapi_makeedge edgec(circle);    edgec.build(); edgec.check();     brepbuilderapi_makewire wirec(edgec.edge());    wirec.build(); wirec.check();     circular = wirec.wire();     // face 1 creation    gp_pln plane(pointzero, dir);    brepbuilderapi_makeface facecreated(plane, circular, standard_true);    facecreated.build(); facecreated.check();     facecircular = facecreated.face(); }  void buildsolid(topods_wire& circ, topods_wire& straight, topods_solid& solid, topods_face facetosweep) {    //breptools::write(straight, "straight.brep");    //breptools::write(circ, "circ.brep");     // in example, shape cylinder class    // brepoffsetapi_makepipe because wire representing     // axis of cylinder might composed of different edges    // alinged.     // line generates tkbrep.dll failure trying access    // 0xffffffffff location.    brepoffsetapi_makepipe shell(straight, facetosweep);     shell.build();    shell.check();     //shell.makesolid();    topexp_explorer solidins(shell.shape(), topabs_solid);     if (!solidins.more())    {       std::cout << "error when creating solid!" << std::endl;       return;    }     solid = topods::solid( solidins.current() ) ;    breptools::write(solid, "solid.brep"); }  void cutface(topods_shape solid, topods_shape face, topods_shape& shape) {    breptools::write(face, "faceincut.brep");    breptools::write(solid, "solidincut.brep");     topods_shape facetocut(face);     topods_shape solidtocut(solid);    brepalgoapi_cut cut(facetocut, solidtocut);    cut.build(); cut.check();     shape = cut.shape(); }  topods_face constructsquareface() {     gp_pnt pone(-100.0, 75.0, 0.0);    gp_pnt ptwo(-100.0, -75.0, 0.0);     gp_pnt pthree(200.0, -75.0, 0.0);    gp_pnt pfour(200.0, 75.0, 0.0);     brepbuilderapi_makeedge edgeone(pone, ptwo);    brepbuilderapi_makeedge edgetwo(ptwo, pthree);    brepbuilderapi_makeedge edgethree(pthree, pfour);    brepbuilderapi_makeedge edgefour(pfour, pone);     brepbuilderapi_makewire wire(edgeone.edge(), edgetwo.edge(), edgethree.edge(), edgefour.edge());    wire.build(); wire.check();     brepbuilderapi_makeface sqface(wire.wire(), standard_true);    sqface.build(); sqface.check();     return sqface.face();  }  void testcrash(void) {    gp_pnt pointzero(0.0, 0.0, 0.0);    gp_pnt pointone(100.0, 0.0, 0.0);     topods_wire circular;    topods_wire straight;    topods_face facecircular;    // method creates circular face swept     // along straight wire represents axis of cylinder.    constructwires(pointzero, pointone, circular, straight, facecircular);     topods_solid solid;    // method constructs solid, i.e. cylinder, used cut.    buildsolid(circular, straight, solid, facecircular);    breptools::write(solid, "solid.brep");     // face cut.    topods_face facetocut = constructsquareface();    breptools::write(facetocut, "sqface.brep");     // perform cut operation.    topods_shape shape;    cutface(solid, facetocut, shape);    breptools::write(shape, "shape.brep");     std::cout << "done!!" << std::endl;  }       int _tmain(int argc, _tchar* argv[])     {        std::cout << "started" << std::endl;          testcrash();        std::cout << "finished" << std::endl;         return 0;     } 

it seems me code correct , there not ambiguous parameters declarations in definitions of functions.

could point me right direction, please?

any appreciated. kind regards,

paolo

i have understood triggers crash of small application. it's related how compile opencascade library. since developing occ code 64bits application, refer latest release of occ, i.e. occ 6.9.0, (for windows @ least) results tested , certified release x64 configuration. however, said, saw same problem version 6.8.0 x64. there might unique fix then.

when occ 6.9.0 installed, win64 folders bin , lib created containing dlls , libraries complied in release mode. if example linked against these files, not crash , results correct.

let's suppose user wants build library himself. following: - open command prompt window , go c:\opencascade6.9.0\opencascade-6.9.0\ folder. - execute custom.bat , msvc.bat vc10 debug win64

this open vc2010 , build configuration can chosen. in solution explorer projects can selected built. instance, in project interested in building projects ones in draw folder. build projects in debug mode , execute example linking against new dlls , libs file (now grouped in win64\vc10\bind , \libd, respectively). in debug mode, said, works fine. on other hand, when same projects built in release mode , application executed crashes.

the cause of error build settings different when compile code in release mode hand , when release dlls , libs installation.

for moment, rely on installed dlls , libs. in case have more details post them here.

kind regards

p.s. sorry giving details. know of them obvious many of you.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -