working through tutorials to understand python/c extension modules
-
plain C functions, no object oriented stuff, no C/Python API (
Python.h
stuff)- write a C file
something_else.c
- expose certain methods to SWIG in
something_else.i
- write module descriptor in
setup.py
and add instruction to set it up in__main__
(see examples) make
:- define which version of
python
to use at the top of Makefile. make
is written to usegenerate_targets.py
to see what you define as extension modules insetup.py
. therefore it is important that you follow all previous steps carefully, otherwise the modules will not get exposed tomake
.
- define which version of
- import in a py script as if you'd import a python module:
from something import something_else
examples:
example.{c,i}
;test.py
- write a C file
-
object oriented stuff
WIP
- the original tutorial:
tutorial on
swig.org
- bugs encountered and workarounds: