Compile c function file into so dynamic library. Run the command gcc mylib.c-fpic-shared-o libtest. so, and you can see the generated library file libtest.so in the directory.
Python calls so library files. Import ctypes first, then load the so file with CDLL, and finally call the corresponding function. Save python code in pydemo.py
Execute python pydemo.py to see the running results.
There are many python training videos on python Learning Network. Welcome to online learning!