I' m trying to import a .so
library into a python code to use c functions. I think using
from ctypes import *
import ctypes
lib = CDLL('./libcaenhvwrapper.so.5.56')
is working fine. I need to use some user defined types which are defined in a header file but I cannot access them.
thank you in advance
The types are not in the .so
file that the ctypes
module loads.
C types don't work like that, they're declared in the header and you must have the header to use a (C) library, even from C.
You're going to have to use the various ctypes
APIs to re-create the types in Python. See this part of the tutorial, for instance, for how to work with struct
and union
types.