its output as beforesimply add swig step to your makefile and compile its output file into shareable object for dynamic linkingand you're in business example - is cygwin makefile that does the job example - pp \integrate\extend\swig\environ\makefile environ-swig build environ extension from swig generated code pylib /usr/local/bin pyinc /usr/local/include/python swig /cygdrive/ /temp/swigwin-/swig _environ dllenviron_wrap gcc environ_wrap - - $(pyinc- $(pylib-lpython -shared - $environ_wrap cenviron $(swig-python environ cleanrm - dll pyc core environ_wrap environ py when run on environ iswig generates two files and two modules--environ py (the python interface module we importand environ_wrap (the lower-level glue code module file we compile into _environ dll to be imported by the pybecause the functions being wrapped here live in standard linked-in librariesthere is nothing to combine with the generated codethis makefile simply runs swig and compiles the wrapper file into extension moduleready to be imported/pp /integrate/extend/swig/environmake - makefile environ-swig /cygdrive/ /temp/swigwin-/swig -python environ gcc environ_wrap - - /usr/local/include/python - /usr/local/bin -lpython -shared - _environ dll and now you're really done the resulting extension module is linked when importedand it' used as before (except that swig handled all the gory bits)/pp /integrate/extend/swig/environls _environ dll environ environ py environ_wrap makefile environ-swig /pp /integrate/extend/swig/environpython import environ environ getenv('user''gilliganenviron __name__environ __file__environ ('environ''environ py'dir(environ'_environ''getenv''putenvwrapping environment calls