In general, I don’t really see how ctypes
is a good idea, yes if you know exactly what compiler you used and what arguments and ensure compatibility you can make a call, but this is pretty much the same as glorified object renaming (see @sblionel’s very valid argument against that here)
Sure the Python libraries ctypes
and np.ctypes
help a bit, make the calls slightly less uglier than mangling symbols and making calls by hand, but it is still essentially the same approach with the same drawbacks. Works for personal projects where users are expected to “read the documentation” and compile accordingly for functionality… Not so useful as a basis for a generic tool.