Skip to content

Instantly share code, notes, and snippets.

@brentp
Created August 8, 2009 20:22
Show Gist options
  • Save brentp/164493 to your computer and use it in GitHub Desktop.
Save brentp/164493 to your computer and use it in GitHub Desktop.
cimport stdlib
ctypedef struct foo:
int a
float b
cdef foo* make_foo(int a, float b):
cdef foo* f = <foo *>stdlib.malloc(sizeof(foo))
f.a = a
f.b = b
return f
cdef foo* f = make_foo(2, 5.0)
print "f.a:", f.a, " f.b:", f.b
stdlib.free(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment