#include "hello-skelimpl.c" #include #include #include #include "orb/orbit.h" #include "hello.h" #define IDFileName "hello.ior" int main (int argc, char *argv[]) { PortableServer_POA poa; PortableServer_POAManager pm; /* String and file to store reference to this */ char *idstring; FILE *idstringfile; /* ORB */ CORBA_Environment ev; CORBA_ORB orb; PortableServer_ObjectId *oid; /* actual hello */ hello cntr; /* trap interrupts */ signal(SIGINT, exit); signal(SIGTERM, exit); /* init ORB */ CORBA_exception_init(&ev); orb = CORBA_ORB_init(&argc, argv, "orbit-local-orb", &ev); poa = (PortableServer_POA)CORBA_ORB_resolve_initial_references(orb, "RootPOA", &ev); cntr = impl_hello__create(poa, &ev); idstring = CORBA_ORB_object_to_string(orb, cntr, &ev); printf("%s\n", idstring); /* save id to a file */ idstringfile = fopen(IDFileName, "w"); fprintf(idstringfile,"%s", idstring); fclose(idstringfile); CORBA_free(idstring); printf("In file %s is the reference to this hello service\nWaiting for connections\n", IDFileName); /* activate object adapter */ pm = PortableServer_POA__get_the_POAManager(poa, &ev); PortableServer_POAManager_activate(pm, &ev); /* start object */ CORBA_ORB_run(orb, &ev); return 0; }