Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / docs / tutorials / Quoter / Simple / Server / server.cpp
blob743b9161fc511e4fc761f2430d50fccbe0b6cbb8
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 ());
28 // Print it out!
29 cout << ior.in () << endl;
31 orb->run ();
33 // Destroy the POA, waiting until the destruction terminates
34 poa->destroy (true, true);
35 orb->destroy ();
37 catch (const CORBA::Exception &) {
38 cerr << "CORBA exception raised!" << endl;
40 return 0;