that embeds python (though could just as well be on topto compile it into dynamically loaded module filerun the makefile in example - on cygwin (and use something similar on other platformsas we learned earlier in this the resulting cregister dll file will be loaded when first imported by python script if it is placed in directory on python' module search path ( in or pythonpath settingsexample - pp \integrate\embed\regist\makefile regist #####################################################################cygwin makefile that builds cregister dll dynamically loaded extension module (shareable)which is imported by register py #####################################################################pylib /usr/local/bin pyinc /usr/local/include/python cmods cregister dll all$(cmodscregister dllcregister gcc cregister - - $(pyinc-shared - $(pylib-lpython - $cleanrm - pyc $(cmodsnow that we have extension module set to register and dispatch python handlersall we need are some python handlers the python module shown in example - defines two callback handler functions and imports the extension module to register handlers and trigger events example - pp \integrate\embed\regist\register py ""########################################################################in pythonregister for and handle event callbacks from the languagecompile and link the codeand launch this with 'python register py########################################################################""################################### calls these python functionshandle an eventreturn result ###################################def callback (labelcount)return 'callback =% number % (labelcountdef callback (labelcount)return 'callback =label count registering callback handler objects