layer is responsible for converting arguments passed from python to form and for converting results from to python form python scripts simply import extensions and use them as though they were really coded in python because code does all the translation workthe interface is very seamless and simple in python scripts modules and types are also responsible for communicating errors back to pythondetecting errors raised by python api callsand managing garbage-collector reference counters on objects retained by the layer indefinitely--python objects held by your code won' be garbage-collected as long as you make sure their reference counts don' fall to zero once codedc modules and types may be linked to python either statically (by rebuilding pythonor dynamically (when first importedthereafterthe extension becomes another toolkit available for use in python scripts simple extension module at least that' the short storyc modules require codeand types require more of it than we can reasonably present in this although this book can' teach you development skills if you don' already have themwe need to turn to some code to make this domain more concrete because modules are simplerand because types generally export module with an instance constructor functionlet' start off by exploring the basics of module coding with quick example as mentionedwhen you add new or existing components to python in the traditional integration modelyou need to code an interface ("glue"logic layer in that handles cross-language dispatching and data translation the source file in example - shows how to code one by hand it implements simple extension module named hello for use in python scriptswith function named message that simply returns its input string argument with extra text prepended python scripts will call this function as usualbut this one is coded in cnot in python example - pp \integrate\extend\hello\hello /******************************************************************* simple extension module for pythoncalled "hello"compile this into soon python pathimport and call hello message********************************************************************#include #include /module functions *static pyobject message(pyobject *selfpyobject *argschar *frompythonresult[ ]if (pyarg_parse(args"( )"&frompython)return null/returns object */self unused in modules */args from python call */convert python - */null=raise exception * simple extension module