高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】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
|