try {
// initialize ORB
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
// find RootPOA
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
// create servant object and activate it
Echo_i* myecho = new Echo_i();
PortableServer::ObjectId_var myechoid = poa->activate_object(myecho);
// Obtain a reference to the object, and print it out as a
// stringified IOR.
obj = myecho->_this();
CORBA::String_var sior(orb->object_to_string(obj));
cerr << (char*)sior << endl;
文章来源于领测软件测试网 https://www.ltesting.net/