Skip to content

Instantly share code, notes, and snippets.

@tito
Forked from ivpusic/gist:5899342
Last active December 19, 2015 04:48
Show Gist options
  • Save tito/5899527 to your computer and use it in GitHub Desktop.
Save tito/5899527 to your computer and use it in GitHub Desktop.
# case 1
if (some condition......):
some code........
else:
# THIS WORKS #
# currently this only works for rangeOfString: method
f_type.size = 0
f_type.alignment = 0
f_type.type = FFI_TYPE_STRUCT
f_type.elements = elements
elements[0] = &ffi_type_uint64
elements[1] = &ffi_type_uint64
elements[2] = NULL
#########################################################
# case 2
cdef void _resolve_complex_ffi_type(self):
cdef:
ffi_type *f_type
ffi_type **elements
f_type = <ffi_type*>malloc(sizeof(ffi_type))
elements = <ffi_type**>malloc(sizeof(ffi_type*) * 3)
f_type.size = 0
f_type.alignment = 0
f_type.type = FFI_TYPE_STRUCT
f_type.elements = elements
elements[0] = &ffi_type_uint64
elements[1] = &ffi_type_uint64
elements[2] = NULL
self.f_result_type = f_type
.
.
.
.
if (some condition......):
some code........
else:
# THIS DOES NOT WORK #
self._resolve_complex_ffi_type()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment