CORBA_double on SGI



Hello,

I am new to ORBit and CORBA and am having some trouble with ORBit
running on an SGI IRIX64 6.5.  My trouble comes down to a call to
ORBit_alloc() in the C language mapping for an array of CORBA_double's. 
I have written a test code included below to replicate the problem. 
Please note that I am not trying to do this directly, however, this is a
test case to replicate what the *-common.c output of the IDL compiler is
doing for me for a `sequence<double>`.

--- Example ---

#include <stdio.h>
#include <string.h>
#include <alloca.h>
 
#include <glib.h>
#define ORBIT_IDL_SERIAL 9
#include <orb/orbit.h>
 
/*
 * Compiled with...
 *
 * gcc -g -o try try.c -I$(GLIB)/include -I$(ORBIT_DIR)/include
-L$(ORBIT_DIR)/lib -lORBit -lIIOP -lORBitutil -L$(GLIB)/lib -lglib -lnsl
-lm -lmalloc
 */
 
/* -------------------------------------------------------- */
int main(int argc, char *argv[])
{
  CORBA_long    len=10;
 
  CORBA_double *retval = (CORBA_double
*)ORBit_alloc(sizeof(CORBA_double)*len, (ORBit_free_childvals)NULL,
GUINT_TO_POINTER(len));
 
  fprintf(stderr,"0x%x\n",retval);              /* Same as for
CORBA_long */
 
  retval[0] = 1.0;                              /* BOOM! */
  fprintf(stderr,"%21.15g\n",retval[0]);        /* BOOM! if above
commented */
}

--- End Example ---

Linking this against the ORBit libraries results in a "Bus Error" as
soon as I attempt to use the `retval` pointer (assignment or print
statement).  This problem is present in the SGI freeware version of
0.5.1, as well as my locally built 0.5.3 and 0.5.5 versions of ORBit. 
If I extract the ORBit_alloc() and its dependencies from the ORBit
source and include them in my test code, I have no problem.  Also, if I
instead use the ORBit libraries for CORBA_float, CORBA_long, etc., I
have no trouble.  My guess is that this is some sort of alignment
problem since 4 byte entities seem to work, but the 8 byte entity fails?

Any help is appreciated, including pointing out what I am doing wrong
here.


wtj




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