Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / ImplRepo / NameService / test.cpp
blob6d4dd83b8fe695c3821ea0247b45bb81acab1fb7
1 #include "orbsvcs/CosNamingC.h"
2 #include "ace/Log_Msg.h"
4 int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
6 try
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"),
16 1);
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"),
24 1);
26 CosNaming::Name name;
27 name.length (1);
28 name[0].id = CORBA::string_dup ("yourself");
30 inc->bind (name, ns_obj.in ());
32 ACE_DEBUG ((LM_DEBUG, "Test Successful\n"));
34 orb->destroy ();
36 catch (const CORBA::Exception& ex)
38 ex._tao_print_exception ("Test");
39 return 1;
42 return 0;