summaryrefslogtreecommitdiff
path: root/demo/pwuid_build.py
blob: 7ef0d76f653170ca6152a612432e85c936180047 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from cffi import FFI
ffi = FFI()
ffi.cdef("""     // some declarations from the man page
    struct passwd {
        char *pw_name;
        ...; 
    };
    struct passwd *getpwuid(int uid);
""")

ffi.set_source('_pwuid_cffi', """   // passed to the real C compiler
#include <sys/types.h>
#include <pwd.h>
""")


if __name__ == '__main__':
    ffi.compile()