2 # -*- coding: utf-8 -*-
6 PythonSideFn
= CFUNCTYPE(None, c_int
)
8 lib
= CDLL("./ctypes-test.so", RTLD_LOCAL
)
10 lib
.set_python_side_fn
.argtypes
= [PythonSideFn
]
11 lib
.set_python_side_fn
.restype
= None
12 lib
.call_python_side_fn
.argtypes
= None
13 lib
.call_python_side_fn
.restype
= None
16 print("Python function called from C code, checker:", checker
)
18 _pyFn
= PythonSideFn(pyFn
)
19 lib
.set_python_side_fn(_pyFn
)
21 print("Python side ready, calling C function now")
22 lib
.call_python_side_fn()