#include#include int main(int argc, char **argv) { // Initialize the ORB CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); // Get a reference to the Naming Service CORBA::Object_var naming_context_obj = orb->resolve_initial_references("NameService"); // Do some stuff with the Naming Service... return 0; }
#includeIn this example, we are getting a reference to the Hello object, narrowing the object reference to the Hello interface, and calling the sayHello method. The Hello_var holds the reference to the Hello interface and automatically destroys the object when it goes out of scope. Package library: The ORB_var is part of the CORBA standard library.#include int main(int argc, char **argv) { // Initialize the ORB CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); // Get a reference to the Hello object CORBA::Object_var obj = orb->string_to_object("corbaloc:iiop:localhost:12345/Hello"); // Narrow the object reference to the Hello interface Hello_var hello = Hello::_narrow(obj); // Call the sayHello method std::cout << hello->sayHello() << std::endl; return 0; }