[Pythonmac-SIG] C module creation on MacPython
Doug Wyatt
doug@sonosphere.com
Fri, 22 Oct 1999 15:31:19 -0400
At 14:56 -0400 10/22/99, Andrew Diller wrote:
> Subject: C module creation on MacPython
>
> Hello:
>
> Can I get some pointers on how C modules are created for MacPython?
>
> Specifically, I'm looking to use the sgmlop module from the madscientist
> (www.pythonware.com/madscientist) and its only available as c source.
>
> What is needed to create a c module in MacPython?
>
> Any help would be appreciated.
Brief recipe:
Start with xxmodule.c (in the Modules directory in the source
distribution). Modify as needed to define your module's functions
and data types (refer to the embedding/extending docs).
Build a CodeWarrior shared library project that includes xxmodule.c
and the PythonCore shared library from your system folder. Name the
output shared library "xx.ppc.slb". Put it somewhere in the module
search path.
In xxmodule.c, export the function "initxx" (where xx is the module
name). This is most simply done by bracketing it with #pragma export.
#pragma export on
extern "C" void // I'm using C++ so extern "C" is neede
initxx()
{
...
}
#pragma export off
Hope I didn't forget anything :)
Doug
--
Doug Wyatt doug@sonosphere.com
http://www.sonosphere.com/