I'm setting up and opening a DLL like this:
from cffi import FFI
ffi = FFI()
api_path = '/path_to/api.h'
lib_path = '/path_to/lib.so'
with open(api_path) as f:
ffi.cdef(f.read())
mylib = ffi.dlopen(lib_path)
myfunc_c = ff.callback('int (char *)', myfunc)
#etc...
How can I close the library and open it again? If I do
del mylib
and try the above code again I get CDefError: cannot parse ...
when
attempting ffi.cdef()
.
I've seen some examples for ctypes using dlclose()
but can't find an equivalent for CFFI.
Thanks.