In this article, we will see calling C function using Python from the basics for Data Science.
First, we will write a simple function using C and hen generate the shred library of the file. Let the name of the file be function.c.
Using ctypes (foreign function interface) library for calling a C function from Python:
The above compile statement will generate a shared library named libfun.so. We will observe how we can make use of it. Python has a library known as ctypes. So, by taking help of this library, it is possible to use C functions in Python. Suppose the file name is function.py.