#include #include "helloC.h" using namespace std; int main(int argc, char **argv) { try { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, ""); CORBA::String_var iorstring = CORBA::string_dup("corbaloc::127.0.0.1:1060/StandardImplName/helloPOA/terriImpl"); CORBA::Object_var obj = orb->string_to_object(iorstring.in()); if (CORBA::is_nil(obj.in())) { cerr << "string to object failed on: " << iorstring.in() << endl; throw 0; } hello_var helloObj = hello::_narrow(obj.in()); if (CORBA::is_nil(helloObj.in())) { cerr << "narrow failed on: " << iorstring.in() << endl; throw 0; } helloObj->say_hello("to me"); CORBA::String_var iorstring2 = CORBA::string_dup("corbaloc::127.0.0.1:1060/StandardImplName/helloPOA/berryImpl"); CORBA::Object_var obj2 = orb->string_to_object(iorstring2.in()); if (CORBA::is_nil(obj2.in())) { cerr << "string to object failed on: " << iorstring2.in() << endl; throw 0; } hello_var helloObj2 = hello::_narrow(obj2.in()); if (CORBA::is_nil(helloObj2.in())) { cerr << "narrow failed on: " << iorstring2.in() << endl; throw 0; } helloObj2->say_hello("to you"); } catch (CORBA::Exception &ex) { cerr << "caught exception: " << ex << endl; } catch (int &i) { } }