#includeint main(int argc, char** argv) { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); // some code orb->destroy(); return 0; }
#includeIn this code, a custom server class is created that receives an ORB object in its constructor. When the server object is destroyed, it destroys the ORB object using the ORB_var destroy function. The ORB_var destroy function is a part of the omniORB library package.class MyServer : public POA_MyServer { CORBA::ORB_var orb; public: MyServer(CORBA::ORB_ptr orb) { this->orb = CORBA::ORB::_duplicate(orb); } // some code ~MyServer() { orb->destroy(); } }; int main(int argc, char** argv) { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); // some code MyServer server(orb); orb->run(); return 0; }