to instance objects...

I have a problem...
I realized 3 interfaces in my system and now I want to use methods of an
intereface inside the implementation of another interface.
To do this I need to invoke the CosNaming service and, given the
identifier string to the service, get the handle to the object to use
The CosNaming invocation begins with the CORBA_orb_init() and
CORBA_orb_resolve_initial_references(). This allows me to have the orb
(CORBA_orb type) and the name server (CosNaming_NamingContext type).
For all these things I need the IOR output; so I thought to write this
IOR in a file, read the file to access it and use it in the
This procedure seems very complex and I believe it exists another one,
easier. Is it??
Moreover this procedure, as I implemented it, doesn't work (I receive an
error message of segmentation fault). So I'm looking for a new way or a
tip that correct my code.
I hope I sufficiently well explained my question... I attach a code
fragment to clarify...

Thanks a lot


   int i;
   int IOR_c=2;
   char IOR1[300] = "./DispatcherDataQueue";
   char IOR2[300] = "-ORBNamingIOR=";
   char * IOR_v[500];
   char temp[300];
   FILE * stream;

   stream = fopen( "IOR", "r");
   if ( stream == NULL)
     printf("Can't open IOR file\n");
      fscanf(stream,"%s", temp);
      for (i=0; i<500; i++) IOR2[i+14] = temp[i];
      for (i=0; i<500; i++) *IOR_v[i] = (char) IOR2[i];;

  if ( (stream = fopen( "IOR", "r")) == NULL)
       printf("Can't open IOR file\n");
      fscanf(stream,"%s", IOR_v[1]);

  orb = CORBA_ORB_init(&IOR_c, IOR_v, "orbit-local-orb", &env);

   name_srv = CORBA_ORB_resolve_initial_references(orb, "NameService",
   g_assert(env._major != CORBA_SYSTEM_EXCEPTION);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]