Implementing the Client in C++, using the CORBA Naming Service
CORBA_Object_var obj = orb -> resolve_initial_references("NameService");
CosNaming_NamingContext_var nc = CosNaming_NamingContext::_narrow(obj);
n[0].id = CORBA_string_dup("a");
n[0].kind = CORBA_string_dup("");
CORBA_Object_var obj = nc -> resolve(n);
Hello_var p = Named::_narrow(obj);
p -> print(“Hello World!”);
- Get naming service
- “Narrow” necessary to get naming context
- Create name in root context
- “Narrow” to derived interface type