Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / LongDouble / client.cpp
blobba0b63637945aec285ee8f01b8147d2def5431c4
1 #include "TestC.h"
2 #include "Global.h"
3 #include "ace/Get_Opt.h"
4 #include "ace/streams.h"
6 const ACE_TCHAR *ior = ACE_TEXT("file://server.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 = 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 int status = 0;
38 try
40 CORBA::ORB_var orb =
41 CORBA::ORB_init (argc, argv);
43 if (parse_args (argc, argv) != 0)
44 return 1;
46 CORBA::Object_var tmp =
47 orb->string_to_object (ior);
49 Test::LongDoubleTest_var longDoubleTest =
50 Test::LongDoubleTest::_narrow (tmp.in ());
52 if (CORBA::is_nil (longDoubleTest.in ()))
54 ACE_ERROR_RETURN ((LM_DEBUG,
55 "Nil Test::LongDoubleTest reference <%s>\n",
56 ior),
57 1);
60 CORBA::LongDouble ld =
61 longDoubleTest->get_long_double ();
63 if (ld == Global::get_long_double ())
65 cout << "Received: " << ld << endl;
67 else
69 ACE_ERROR ((LM_DEBUG,
70 "Client did not receive "
71 "expected CORBA::LongDouble\n"));
72 cerr << "Received: " << ld << " instead of "
73 << Global::get_long_double () << endl;
74 status = 1;
77 longDoubleTest->shutdown ();
79 orb->destroy ();
81 catch (const CORBA::Exception& ex)
83 ex._tao_print_exception ("Exception caught:");
84 status = 1;
87 return status;