3 ms·
This article might be a little outdated now (2017). Recently, I've enjoyed using the Python cffi module to interface with C libraries: # not tested! this_
by bsdz 5y ago
This article might be a little outdated now (2017).
Recently, I've enjoyed using the Python cffi module to interface with C libraries:
# not tested!
this_dir = Path(__file__).parent
ffi = cffi.FFI()
ffi.cdef((this_dir / "awesome.h").read_text())
lib = ffi.dlopen(str(this_dir / "awesome.so"))
print("awesome.Add(12,99) = %d" % lib.Add(12,99))