2 #include "ace/OS_NS_stdio.h"
3 #include "ace/CORBA_macros.h"
5 const ACE_TCHAR
*ior_output_file
= ACE_TEXT("test.ior");
8 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
12 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
14 CORBA::Object_var poa_object
=
15 orb
->resolve_initial_references ("RootPOA");
17 if (CORBA::is_nil (poa_object
.in ()))
19 ACE_ERROR_RETURN ((LM_ERROR
,
20 " (%P|%t) Unable to initialize the POA.\n"),
24 PortableServer::POA_var root_poa
=
25 PortableServer::POA::_narrow (poa_object
.in ());
27 PortableServer::POAManager_var poa_manager
=
28 root_poa
->the_POAManager ();
31 test_var server
= svnt
._this ();
33 CORBA::String_var ior
=
34 orb
->object_to_string (server
.in ());
36 FILE *output_file
= ACE_OS::fopen (ior_output_file
, "w");
40 ACE_ERROR_RETURN ((LM_ERROR
,
41 "Can't open output file for writing IOR: %s",
46 ACE_OS::fprintf (output_file
,
49 ACE_OS::fclose (output_file
);
51 poa_manager
->activate ();
54 /// Destroy the POA, waiting until the destruction terminates,
56 root_poa
->destroy (true, true);
59 catch (const CORBA::Exception
&ex
)
61 ex
._tao_print_exception ("Server: exception caught:");