description file (usually with suffixor / +header or source file interface files like this one are the most common input formthey can contain comments in or +formattype declarations just like standard header filesand swig directives that all start with for example%module sets the module' name as known to python importers %%encloses code added to generated wrapper file verbatim extern statements declare exports in normal ansi / +syntax %include makes swig scan another file (- flags give search pathsin this exampleswig could also be made to read the hellolib header file of example - directly but one of the advantages of writing special swig input files like hellolib is that you can pick and choose which functions are wrapped and exported to pythonand you may use directives to gain more control over the generation process swig is utility program that you run from your build scriptsit is not programming languageso there is not much more to show here simply add step to your makefile that runs swig and compile its output to be linked with python example - shows one way to do it on cygwin example - pp \integrate\extend\swig\makefile hellolib-swig #################################################################use swig to integrate hellolib for use in python programs on cygwin the dll must have leading "_in its name in current swig (>because also makes py without "_in its name #################################################################pylib /usr/local/bin pyinc /usr/local/include/python clib /hellolib swig /cygdrive/ /temp/swigwin-/swig the library plus its wrapper _hellowrap dllhellolib_wrap $(clib)/hellolib gcc -shared hellolib_wrap $(clib)/hellolib - $(pylib-lpython - $generated wrapper module code hellolib_wrap ohellolib_wrap $(clib)/hellolib gcc hellolib_wrap - - $(clib- $(pyinc- - $hellolib_wrap chellolib $(swig-python - $(clibhellolib the swig integration code generator