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 API from Extension Module in Python | Set 1
- C Extension Module using Python
- Python | Passing Filenames to Extension in C
- Python | Extension function operating on Arrays
- Python | Opaque Pointers in C extension modules
- Python | Sort and store files with same extension
- Fraction module in Python
- OS Module in Python with Examples
- Import module in Python
- OS Path module in Python
- Python Urllib Module
- Pylatex module in python
- Python | Calendar Module
- struct module in Python
- Pygorithm module in Python
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.