Beispiel #1
0
static void
cls_struct_3byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata)
{

  struct cls_struct_3byte a1, a2;

  a1 = *(struct cls_struct_3byte*)(args[0]);
  a2 = *(struct cls_struct_3byte*)(args[1]);

  *(cls_struct_3byte*)resp = cls_struct_3byte_fn(a1, a2);
}
Beispiel #2
0
  printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b);

  return  result;
}

static void
cls_struct_3byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
		    void* userdata __UNUSED__)
{

  struct cls_struct_3byte a1, a2;

  a1 = *(struct cls_struct_3byte*)(args[0]);
  a2 = *(struct cls_struct_3byte*)(args[1]);

  *(cls_struct_3byte*)resp = cls_struct_3byte_fn(a1, a2);
}

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[4];
  ffi_type cls_struct_type;
  ffi_type* dbl_arg_types[5];

  struct cls_struct_3byte g_dbl = { 12, 119 };
  struct cls_struct_3byte f_dbl = { 1, 15 };
  struct cls_struct_3byte res_dbl;