几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】crash on exi (http://www.dimcax.com/hust/showthread.php?t=15536)

yang686526 2009-05-04 06:34 PM

【转帖】crash on exi
 
crash on exit
crash on exit
to get started using dd i wrote this small program. everything was cut out from the odwriteex example program, but the program seem to crash on the return statement, what could be wrong?
code:
class myservices : public exsystemservices, public exhostappservices
{
protected:
odrx_using_heap_operators(exsystemservices);
};
int main(int argc, char* argv[])
{
odstaticrxobject<myservices> svcs;
odinitialize(&svcs);
oddbdatabaseptr pdb = svcs.createdatabase(true,oddb::kmetric);
oddbblocktablerecordptr pps = pdb->getpaperspaceid().safeopenobject(oddb::kforwrite);
oddbcircleptr pcircle = oddbcircle::createobject();
pcircle->setradius(1.0);
pps->appendoddbentity(pcircle);
odwrfilebuf fb("jekout.dxf");
pdb->writefile( &fb, oddb::kdxf , oddb::vac12 , true );
oduninitialize();
return 0;
}
i just want to compile and run the simplest of all, could i do even simpler than something like this?
thanks
jesper

ohh, got it! seems like i need to release the database pointer pointer before uninitialize can be called, either by doing "pdb.release()", or letting the pointer go out of scope, before the "oduninitialize()" call.
you are absolutely right. in your initial variant smart pointer was holding the database and it was destroyed after call to oduninitialize().
sergey slezkin


所有的时间均为北京时间。 现在的时间是 11:32 AM.