1. Jeremy Thurgood
  2. cffi

Source

cffi / testing / snippets / package / snip_package / __init__.py


from cffi import FFI

ffi = FFI()
ffi.cdef("""     // some declarations from the man page
    struct passwd {
        char *pw_name;
        ...;
    };
    struct passwd *getpwuid(int uid);
""")
C = ffi.verify("""   // passed to the real C compiler
#include <sys/types.h>
#include <pwd.h>
""", libraries=[], ext_package="ext_package")