Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- from cffi import FFI
- ffi = FFI()
- ffi.cdef("""
- void hello(char name[]); // copy-pasted from the man page
- """)
- my_lib = ffi.dlopen('./hello') # loads the entire C namespace
- arg = ffi.new("char[]", b"from Python") # equivalent to C code: char arg[] = "world";
- my_lib.hello(arg)
- # print("Hello!")
Advertisement
Add Comment
Please, Sign In to add comment