JIMMY-KSU / swig-tutorial-py-c

working through tutorials to understand python/c extension modules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

swig-tutorial-py-c

working through tutorials to understand python/c extension modules

workflow

  • plain C functions, no object oriented stuff, no C/Python API (Python.h stuff)

    1. write a C file something_else.c
    2. expose certain methods to SWIG in something_else.i
    3. write module descriptor in setup.py and add instruction to set it up in __main__ (see examples)
    4. make:
      • define which version of python to use at the top of Makefile.
      • make is written to use generate_targets.py to see what you define as extension modules in setup.py. therefore it is important that you follow all previous steps carefully, otherwise the modules will not get exposed to make.
    5. import in a py script as if you'd import a python module: from something import something_else

    examples:

    • example.{c,i}; test.py
  • object oriented stuff

    WIP

resources

About

working through tutorials to understand python/c extension modules

License:GNU General Public License v3.0


Languages

Language:Python 41.9%Language:Makefile 38.2%Language:C 19.9%