Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / Server_Connection_Purging / client2.cpp
bloba6a6eec142f7f73d0966e86ba7c1177c0492345a
2 #include "ace/Get_Opt.h"
3 #include "TestC.h"
5 // Name of file contains ior.
6 static const ACE_TCHAR *IOR = ACE_TEXT ("file://ior");
8 static int
9 parse_args (int argc, ACE_TCHAR **argv)
11 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:i:d:x"));
12 int c;
14 while ((c = get_opts ()) != -1)
15 switch (c)
17 case 'k':
18 IOR = get_opts.opt_arg ();
19 break;
20 case '?':
21 default:
22 ACE_ERROR_RETURN ((LM_ERROR,
23 "usage: %s "
24 "-k IOR "
25 "\n",
26 argv [0]),
27 -1);
30 if (IOR == 0)
31 ACE_ERROR_RETURN ((LM_ERROR,
32 "Please specify the IOR for the servant\n"), -1);
34 // Indicates successful parsing of command line.
35 return 0;
39 int
40 ACE_TMAIN (int argc, ACE_TCHAR *argv[])
42 try
44 // Initialize the ORB.
45 CORBA::ORB_var orb =
46 CORBA::ORB_init (argc, argv);
48 // Initialize options based on command-line arguments.
49 int parse_args_result = parse_args (argc, argv);
50 if (parse_args_result != 0)
51 return parse_args_result;
53 // Get an object reference from the argument string.
54 CORBA::Object_var object =
55 orb->string_to_object (IOR);
57 // Try to narrow the object reference to a <test> reference.
58 test_var test_object = test::_narrow (object.in ());
60 ACE_DEBUG ((LM_DEBUG,
61 "(%P|%t) Sending a shutdown call..\n"));
62 test_object->shutdown ();
64 orb->destroy ();
66 catch (const CORBA::Exception& ex)
68 ex._tao_print_exception ("Exception caught:");
69 return -1;
72 return 0;