Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / Bug_2869_Regression / client.cpp
bloba9d1a28798789674dd33c5ab8a09457671947780
1 #include "tao/ORB.h"
2 #include "tao/Object.h"
3 #include "tao/SystemException.h"
4 #include "ace/Get_Opt.h"
6 const ACE_TCHAR *ior_output_file = ACE_TEXT("test.ior");
8 int
9 parse_args (int argc, ACE_TCHAR *argv[])
11 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
12 int c;
14 while ((c = get_opts ()) != -1)
15 switch (c)
17 case 'k':
18 ior_output_file = get_opts.opt_arg ();
19 break;
21 case '?':
22 default:
23 ACE_ERROR_RETURN ((LM_ERROR,
24 "usage: %s "
25 "-k <ior> "
26 "\n",
27 argv [0]),
28 -1);
30 // Indicates successful parsing of the command line
31 return 0;
34 int
35 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
37 try
39 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
41 if (parse_args (argc, argv) != 0)
42 return 1;
44 CORBA::Object_var tmp =
45 orb->string_to_object("iiop://1\"/2$/$3211:2500/EndPoint");
47 catch (const CORBA::INV_OBJREF&)
49 ACE_DEBUG ((LM_DEBUG, "Test succeeded\n"));
51 catch (...)
53 ACE_ERROR ((LM_ERROR, "Caught invalid exception\n"));
54 return 1;
57 // Write dummy file to trigger the test framework we are ready.
58 FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
59 if (output_file == 0)
60 ACE_ERROR_RETURN ((LM_ERROR,
61 "Cannot open output file for writing IOR: %s\n",
62 ior_output_file),
63 1);
64 ACE_OS::fprintf (output_file, "dummy");
65 ACE_OS::fclose (output_file);
67 return 0;