Back to index

python3.2  3.2.2
Classes | Functions
struct3.c File Reference
#include "ffitest.h"

Go to the source code of this file.


struct  test_structure_3


static test_structure_3 struct3 (test_structure_3 ts)
int main (void)

Class Documentation

struct test_structure_3

Definition at line 10 of file struct3.c.

Class Members
int si

Function Documentation

int main ( void  )

Definition at line 22 of file struct3.c.

  ffi_cif cif;
  ffi_type *args[MAX_ARGS];
  void *values[MAX_ARGS];
  int compare_value;
  ffi_type ts3_type;
  ffi_type *ts3_type_elements[2];
  ts3_type.size = 0;
  ts3_type.alignment = 0;
  ts3_type.type = FFI_TYPE_STRUCT;
  ts3_type.elements = ts3_type_elements;
  ts3_type_elements[0] = &ffi_type_sint;
  ts3_type_elements[1] = NULL;

  test_structure_3 ts3_arg;
  test_structure_3 *ts3_result = 
    (test_structure_3 *) malloc (sizeof(test_structure_3));
  args[0] = &ts3_type;
  values[0] = &ts3_arg;
  /* Initialize the cif */
  CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 
                   &ts3_type, args) == FFI_OK); = -123;
  compare_value =;
  ffi_call(&cif, FFI_FN(struct3), ts3_result, values);
  printf ("%d %d\n", ts3_result->si, -(compare_value*2));
  CHECK(ts3_result->si == -(compare_value*2));
  free (ts3_result);

Here is the call graph for this function:

static test_structure_3 struct3 ( test_structure_3  ts) [static]

Definition at line 15 of file struct3.c.

{ = -(*2);

  return ts;

Here is the caller graph for this function: