|
发表于 2010-4-16 11:03:22
|
显示全部楼层
回复 #1 longwenbiao 的帖子
CORBA::ORB_var orb = CORBA::ORB_init(argc,argv,"");
CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(poa_object.in());
PortableServer::POAManager_var poa_manager = poa->the_POAManager();
poa_manager->activate();
//Get the Naming Context reference
CORBA::Object_var naming_context_object= orb->resolve_initial_references("NameService");
CosNaming::NamingContext_var naming_context = CosNaming::NamingContext::_narrow(naming_context_object.in());
Servant servant();
poa->activate_object(&servant);
CORBA::Object_var objservant = servant._this();
CosNaming::Name nameservant;
nameservant.length (1);
nameservant[0].id = CORBA::string_dup ("servant");
// call rebind instead bind
naming_context->rebind(servant, objservant.in()); |
|