summaryrefslogtreecommitdiff
path: root/demo/pwuid_build.py
diff options
context:
space:
mode:
Diffstat (limited to 'demo/pwuid_build.py')
-rw-r--r--demo/pwuid_build.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/demo/pwuid_build.py b/demo/pwuid_build.py
new file mode 100644
index 0000000..7ef0d76
--- /dev/null
+++ b/demo/pwuid_build.py
@@ -0,0 +1,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()