Prerequisite: C API from Extension Module in Python | Set 1
Let’s see an example of a new extension module that loads and uses these API functions that we build up in the previous article.
Code #1 :
Code #2 : Module initialization function
Now to compile this new module, one need not bother about how to link against any of the libraries or code from the other module. One can just simply use
work.py file as shown below.
Code #3 :
After performing all this task, this new extension function works perfectly with the C API functions defined in the other module.
Code #4 : Using CPI API functions defined in the other module
Point_1 : 2.000000 3.000000
- C Extension Module using Python
- C API from Extension Module in Python | Set 1
- Python | Passing Filenames to Extension in C
- Python | Extension function operating on Arrays
- Python | Sort and store files with same extension
- Python | Repeat and Multiply list extension
- Python | Opaque Pointers in C extension modules
- pwd module in Python
- grp module in Python
- Pylatex module in python
- Python | Calendar Module
- OS Path module in Python
- Pathlib module in Python
- struct module in Python
- Python winsound module
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.