else strcpy(result"hello")strcat(resultfrompython)return py_buildvalue(" "result)/build up string */add passed python string */convert -python */registration table *static pymethoddef hello_methods[{"message"messagemeth_varargs"func doc"}{nullnull null}/name&funcfmtdoc */end of table marker */module definition structure *static struct pymoduledef hellomodule pymoduledef_head_init"hello"/name of module *"mod doc"/module documentationmay be null *- /size of per-interpreter module state- =in global vars *hello_methods /link to methods table *}/module initializer *pymodinit_func pyinit_hello(/called on first import */name matters if loaded dynamically *return pymodule_create(&hellomodule)this module has -part standard structure described by its commentswhich all modules followand which has changed noticeably in python ultimatelypython code will call this file' message functionpassing in string object and getting back new string object firstthoughit has to be somehow linked into the python interpreter to use this file in python scriptcompile it into dynamically loadable object file ( hello so on linuxhello dll under cygwin on windowswith makefile like the one listed in example - and drop the resulting object file into directory listed on your module import search path exactly as though it were py or pyc file example - pp \integrate\extend\hello\makefile hello ############################################################compile hello into shareable object file on cygwinto be loaded dynamically when first imported by python ############################################################pylib /usr/local/bin pyinc /usr/local/include/python hello dllhello gcc hello - - $(pyinc-shared - $(pylib-lpython - hello dll cleanrm - hello dll core python/ integration