SoFunction
Updated on 2024-11-17

Python implementation of the call C function function simple example

In this article, examples of Python implementation of the call C function function. Shared for your reference, as follows:

Example referencepython cookbook Example in Section 15.1 of the P612 page

Compile the c-file into a so-file first

gcc  -fpic -shared -o 

Compile the so file from above

utilizationctypesModule.

from ctypes import cdll
a=("./")
()

Can pass the code test above.

Readers interested in more Python related content can check out this site's topic: theSummary of Python process and thread manipulation techniques》、《Python Data Structures and Algorithms Tutorial》、《Summary of Python function usage tips》、《Summary of Python string manipulation techniques》、《Python introductory and advanced classic tutorialsand theSummary of Python file and directory manipulation techniques

I hope that what I have said in this article will help you in Python programming.