When working on a Python project recently, I needed to call C++ dynamic library files. Both Python’s built-in ctypes library and the pybind11 library can interface with dynamic libraries.
ctypes
Use ctypes for simple data types - it’s preinstalled with Python and straightforward to use
However, when dealing with C++ complex types like vector, it throws Segmentation fault (core dumped) errors because ctypes lacks native support for vector type mapping