File: snip_basic_verify.py

package info (click to toggle)
python-cffi 1.9.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,440 kB
  • ctags: 4,423
  • sloc: python: 25,052; ansic: 12,528; asm: 116; makefile: 97; sh: 28
file content (17 lines) | stat: -rw-r--r-- 428 bytes parent folder | download | duplicates (44)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

from cffi import FFI
import sys

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=[],    # or a list of libraries to link with
     force_generic_engine=hasattr(sys, '_force_generic_engine_'))