-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
GPU Programming with C++ and CUDA
By :
Having a library is useless if we have no way of using it in our program. Luckily there is a Python module called ctypes that allows interaction with shared libraries written in C or C++. It enables our Python programs to call library functions as if they were native Python functions. This mechanism provides an easy way to leverage high-performance C++ code while still benefiting from Python’s flexibility and ease of use.
Using ctypes we can load shared libraries, declare function signatures, and invoke native functions easily. A great advantage is that it does not require any modification to the original C++ source code, making it an appealing option for lightweight integration.
Another interesting thing is that it is purely Python based, meaning that we can write code on the Python side to define what we want to use from the library without the need to compile anything. However, ctypes has its limitations: for example it requires manual mapping of function...