[PYTHONMAC-SIG] Forwarded message: extension module
Jack Jansen
Jack.Jansen@cwi.nl
Thu, 07 Mar 1996 12:28:00 +0100
>
> Here is what I did:
> * Wrote a tiny module with just one function (source is included at the end.)
> Source file name: "myfirstmodule.c", shared lib name:
> "myfirstmodule".
The library name should end in .slb, as you already noted.
> * Copied the CW7 PythonCore project file, removed the sources from that and
> added my module source file (retained the run-time and shared lib
glue stuff).
This is probably not the best way to do it. There is a skeleton
project file xxmodule.{mu} that is ready for use. One thing to keep in
mind (it recently bit me): if your extension module contains C++ code
anywhere you will have to supply a PEF init function that (at the very
least) calls __sinit() to do C++ static initializers. The MetroWerks
documentation has details.
> * Built the shared lib successfully and copied it to the system extension
> folder.
It shouldn't go into the extension folder, you should put it somewhere
along sys.path. "PlugIns" is the standard place.
This whole process, by the way, is documented since a few months,
check out <http://www.cwi.nl/~jack/macpython/>. Besides this extension
example it also has some stuff on using toolbox calls and appleevents
from python.
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++
http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm
=================
PYTHONMAC-SIG - SIG on Python for the Apple Macintosh
send messages to: pythonmac-sig@python.org
administrivia to: pythonmac-sig-request@python.org
=================