inc/probe/bigendian64.c
raw| 1 | #include "ffi_platypus.h" |
| 2 | |
| 3 | unsigned char |
| 4 | my_foo(void) |
| 5 | { |
| 6 | return 0xaa; |
| 7 | } |
| 8 | |
| 9 | int |
| 10 | dlmain(int argc, char *argv[]) |
| 11 | { |
| 12 | ffi_cif cif; |
| 13 | ffi_type *args[1]; |
| 14 | void *values[1]; |
| 15 | unsigned char bytes[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
| 16 | |
| 17 | if(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_uint8, args) ==FFI_OK) |
| 18 | { |
| 19 | ffi_call(&cif, (void *) my_foo, &bytes, values); |
| 20 | if(bytes[7] == 0xaa) |
| 21 | { |
| 22 | return 0; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | return 2; |
| 27 | } |