Package: libffi2 Version: 1:3.2.1-0pre3 Severity: normal ffi_type_uint8 and other arguments shorter than one word are not passed in correctly to the function called by ffi_call.
Also, returns values are not passed correctly. For example, instead of finding the returned byte value where the pointer points to, it is found at an offset of 3 from the pointer. This is related to the fact that the powerpc is a big endian machine and somewhere, bytes need to be moved. I have included code and output I get on my powerpc machine. Thanks, David ----- #include <stdio.h> #include <ffi.h> unsigned char identity(unsigned char c) { printf("identity: %d\n", c); return c; } int main(void) { ffi_cif cif; ffi_type *args[1]; void *values[1]; int b; unsigned char result; int i; args[0] = &ffi_type_uint; /* * args[0] = &ffi_type_uint8; - if this type is specified, * function always receives 0. */ b = 24; values[0] = &b; if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint8, args) != FFI_OK) { printf("error\n"); return 1; } ffi_call(&cif, identity, &result, values); printf("at result: %d\n", result); printf("at result + 3: %d\n", *(&result + 3)); /* for (i = 0; i < sizeof(result); i++) { printf("byte %d = %d\n", i, *((unsigned char *) &result)); } */ return 0; } ----- output: identity: 24 at result: 0 at result + 3: 24 ----- David -- System Information Debian Release: testing/unstable Architecture: powerpc Kernel: Linux ibou 2.4.20-rc1-ben0 #3 Thu Nov 14 22:24:15 EST 2002 ppc Locale: LANG=C, LC_CTYPE=C Versions of packages libffi2 depends on: ii gcc-3.2-base 1:3.2.1-0pre3 The GNU Compiler Collection (base ii libc6 2.2.5-14.3 GNU C Library: Shared libraries an