Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / Bug_1636_Regression / client.cpp
blob597f70f1cac53008aaa6777fc073b462ecc48386
1 #include "tao/DynamicInterface/Request.h"
2 #include "tao/DynamicAny/DynAnyFactory.h"
3 #include "testC.h"
5 int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
7 try
9 CORBA::ORB_var orb =
10 CORBA::ORB_init (argc, argv);
12 ACE_DEBUG ((LM_DEBUG,"Get reference to the DynAny Factory\n"));
13 CORBA::Object_var obj =
14 orb->resolve_initial_references ("DynAnyFactory");
16 DynamicAny::DynAnyFactory_var daf =
17 DynamicAny::DynAnyFactory::_narrow (obj.in());
19 UnionIecs::S_i_num s_num;
20 s_num.type_num = UnionIecs::E_type_num_called_party_number;
21 s_num.nature = 5;
23 UnionIecs::S_num num1;
24 num1.num(s_num);
25 CORBA::Any MyAny1;
26 MyAny1 <<= num1;
28 ACE_DEBUG ((LM_DEBUG,
29 "calling from_any () and to_any () with non-empty union...\n"));
30 DynamicAny::DynAny_var dynany1 =
31 daf->create_dyn_any_from_type_code (UnionIecs::_tc_S_num);
33 dynany1->from_any(MyAny1);
34 CORBA::Any_var arg1 =
35 dynany1->to_any ();
37 ACE_DEBUG ((LM_DEBUG, "...done\n"));
39 UnionIecs::S_num num2;
40 num2._default();
41 CORBA::Any MyAny2;
42 MyAny2 <<= num2;
44 ACE_DEBUG ((LM_DEBUG,
45 "calling from_any () and to_any () with empty union...\n" ));
46 DynamicAny::DynAny_var dynany2 =
47 daf-> create_dyn_any_from_type_code (UnionIecs::_tc_S_num);
49 dynany2->from_any (MyAny2);
51 CORBA::Any_var arg2 =
52 dynany2->to_any();
54 ACE_DEBUG ((LM_DEBUG,"...done.\nTest passed.\n"));
56 // Finally destroy the ORB
57 orb->destroy ();
59 catch (const CORBA::Exception& ex)
61 ex._tao_print_exception ("Exception - test failed:\n");
62 return 1;
65 return 0;