Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / Bug_1361_Regression / shutdown.cpp
blob1da174a9384f91fc0681b453833cf6969b65a799
1 #include "TestC.h"
2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
6 int
7 parse_args (int argc, ACE_TCHAR *argv[]);
9 int
10 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
12 ACE_DEBUG ((LM_DEBUG,
13 "Starting shutdown\n"));
14 try
16 CORBA::ORB_var orb =
17 CORBA::ORB_init (argc, argv);
19 if (parse_args (argc, argv) != 0)
20 return 1;
22 CORBA::Object_var tmp =
23 orb->string_to_object(ior);
25 Test::Echo_Caller_var server =
26 Test::Echo_Caller::_narrow(tmp.in ());
28 if (CORBA::is_nil (server.in ()))
30 ACE_ERROR_RETURN ((LM_DEBUG,
31 "Nil Test::Echo_Caller reference <%s>\n",
32 ior),
33 1);
36 server->shutdown ();
38 orb->destroy ();
40 catch (const CORBA::Exception& ex)
42 ex._tao_print_exception ("Exception caught:");
43 return 1;
46 return 0;
49 int
50 parse_args (int argc, ACE_TCHAR *argv[])
52 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
53 int c;
55 while ((c = get_opts ()) != -1)
56 switch (c)
58 case 'k':
59 ior = get_opts.opt_arg ();
60 break;
62 case '?':
63 default:
64 ACE_ERROR_RETURN ((LM_ERROR,
65 "usage: %s "
66 "-k <ior> "
67 "\n",
68 argv [0]),
69 -1);
71 // Indicates successful parsing of the command line
72 return 0;