Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / docs / tutorials / Quoter / AMI / server.cpp
blob706b523ac2c1980e4f2023a36423ec81bd098038
2 #include "Stock_Factory_i.h"
3 #include "ace/streams.h"
5 int ACE_TMAIN (int argc, ACE_TCHAR* argv[])
7 try {
8 // First initialize the ORB, that will remove some arguments...
9 CORBA::ORB_var orb =
10 CORBA::ORB_init (argc, argv);
11 CORBA::Object_var poa_object =
12 orb->resolve_initial_references ("RootPOA");
13 PortableServer::POA_var poa =
14 PortableServer::POA::_narrow (poa_object.in ());
15 PortableServer::POAManager_var poa_manager =
16 poa->the_POAManager ();
17 poa_manager->activate ();
19 // Create the servant
20 Quoter_Stock_Factory_i stock_factory_i;
22 // Activate it to obtain the object reference
23 Quoter::Stock_Factory_var stock_factory =
24 stock_factory_i._this ();
26 // Put the object reference as an IOR string
27 CORBA::String_var ior = orb->object_to_string (stock_factory.in ());
29 // Print it out!
30 cout << ior.in () << endl;
32 orb->run ();
34 // Destroy the POA, waiting until the destruction terminates
35 poa->destroy (true, true);
36 orb->destroy ();
38 catch (const CORBA::Exception &) {
39 cerr << "CORBA exception raised!" << endl;
41 return 0;