re: long longlong in libffi (powerpc)

Andreas Tobler toa@pop.agri.ch
Tue Jan 21 08:22:00 GMT 2003


To follow up. (Sorry can't quote, webmail)
The problem I have is also visible on powerpc-linux.
Given this testcase:
static void closure_test_fn4(ffi_cif* cif,void* resp,void** args,
 void* userdata)
 {
 *(ffi_arg*)resp =
 (int)*(long *)args[0] +(*(int *)args[1]) +
 /* (int)(*(float *)args[2]) + *(int *)args[3]*/ + (int)(long)userdata;
 printf("%d %d %d %d: %d\n",
 (int)*(long *)args[0], (*(int *)args[1]),
 /* (int)(*(float *)args[2]), *(int *)args[3],*/ (int)(long)userdata,
 *(int*)resp);
 }
typedef int (*closure_test_type4)(long, int);
I run it with this definition:
 cl_arg_types[0] = &ffi_type_ulong;
 cl_arg_types[1] = &ffi_type_uint;
 cl_arg_types[2] = NULL;
Here I get a failure since ulong is 'mapped' onto longlong (8bytes)
setting the arg[0] type to &ffi_type_uint32 makes the testcase pass.
So I'm a bit confused. My long is 4 byte, my longlong 8. And the ABI from
sysv & darwin handles the long and the longlong different. (long !=longlong)
Do I follow a phantom or my one explain to me what I forget?
Thank you in advance.
Andreas


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /