The example below shows how the initial naming context is retrieved:
// Obtain the CORBA CosNaming initial naming context that
// we will use to resolve objects by name. The ORB retrieves
// the naming server address from command line arguments or
// the environment.
CORBA::Object_var obj =
orb->resolve_initial_references("NameService");
CosNaming::NamingContext_var nc =
CosNaming::NamingContext::_narrow(obj);
if (CORBA::is_nil(nc)) {
cout << "Error: Null NamingContext instance. Exiting.";
return -1;
}
| Copyright © 2003. Sybase Inc. All rights reserved. |
|
|