Пример #1
0
static void
cls_struct_24byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata)
{
  struct cls_struct_24byte b0, b1, b2, b3;

  b0 = *(struct cls_struct_24byte*)(args[0]);
  b1 = *(struct cls_struct_24byte*)(args[1]);
  b2 = *(struct cls_struct_24byte*)(args[2]);
  b3 = *(struct cls_struct_24byte*)(args[3]);

  *(cls_struct_24byte*)resp = cls_struct_24byte_fn(b0, b1, b2, b3);
}
Пример #2
0
    return result;
}

static void
cls_struct_24byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
                     void* userdata __UNUSED__)
{
    struct cls_struct_24byte b0, b1, b2, b3;

    b0 = *(struct cls_struct_24byte*)(args[0]);
    b1 = *(struct cls_struct_24byte*)(args[1]);
    b2 = *(struct cls_struct_24byte*)(args[2]);
    b3 = *(struct cls_struct_24byte*)(args[3]);

    *(cls_struct_24byte*)resp = cls_struct_24byte_fn(b0, b1, b2, b3);
}

int main (void)
{
    ffi_cif cif;
    void *code;
    ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
    void* args_dbl[5];
    ffi_type* cls_struct_fields[5];
    ffi_type cls_struct_type;
    ffi_type* dbl_arg_types[5];

    cls_struct_type.size = 0;
    cls_struct_type.alignment = 0;
    cls_struct_type.type = FFI_TYPE_STRUCT;