1 #include "orbsvcs/CosNamingC.h"
2 #include "ace/Log_Msg.h"
4 int ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
8 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
10 CORBA::Object_var ns_obj
=
11 orb
->resolve_initial_references ("NameService");
13 if (CORBA::is_nil (ns_obj
.in ()))
14 ACE_ERROR_RETURN ((LM_ERROR
,
15 "Could not resolve Naming Service"),
18 CosNaming::NamingContext_var inc
=
19 CosNaming::NamingContext::_narrow (ns_obj
.in ());
21 if (CORBA::is_nil (inc
.in ()))
22 ACE_ERROR_RETURN ((LM_ERROR
,
23 "Could not resolve Naming Service"),
28 name
[0].id
= CORBA::string_dup ("yourself");
30 inc
->bind (name
, ns_obj
.in ());
32 ACE_DEBUG ((LM_DEBUG
, "Test Successful\n"));
36 catch (const CORBA::Exception
& ex
)
38 ex
._tao_print_exception ("Test");