#include#include #include using namespace std; int main(int argc, char **argv) { try { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); // Use the ORB here... orb->run(); orb->destroy(); } catch (CORBA::Exception &ex) { cerr << "Caught CORBA exception: " << ex << endl; } return 0; }
#include "Example.h" #includeThis example shows how to use the ORB to invoke a remote method on an object located on another machine. The remote object is obtained using the `string_to_object()` method and then narrowed to the correct type using the `_narrow()` method. The `helloWorld()` method is then called on the remote object. The CPP CORBA ORB_var run code examples are part of the CORBA library that is provided by the vendor. The package library would depend on the vendor that provides the CORBA implementation. Some popular CORBA implementations include TAO and ORBacus.#include #include using namespace std; int main(int argc, char **argv) { try { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); // Get a reference to the remote object Example_var ex = Example::_narrow(orb->string_to_object("corbaloc:iiop:localhost:1234/Example")); // Call a method on the remote object ex->helloWorld(); orb->run(); orb->destroy(); } catch (CORBA::Exception &ex) { cerr << "Caught CORBA exception: " << ex << endl; } return 0; }