[Pythonmac-SIG] Carbonized embedded python

Matt Sykes mattmsykes@yahoo.co.uk
Tue, 9 Apr 2002 06:30:48 +0100 (BST)


Hi,

I would like to embed Python into an already-existing Carbon
application.

The application is quite large, so removing/replacing all the Carbon
API calls would be infeasible at this point due to time constraints.
That is, I must use Carbonized Python libs.

I downloaded and installed MacPython22full.bin which contains some
Carbon libs.  I soon found that I didn't have any header files.

On to the source.  There are two places to obtain sources: python.org
and the MacPython homepage, http://www.cwi.nl/~jack/macpython.html.

I grab MacPython22src.sit from ftp://ftp.cwi.nl/pub/jack/python/mac/.

Hoping for the best, I tried using those header files to compile an
embedded-python test program with my Carbon libs.  My machine promptly
crashed when I ran it.  To me this means that either the header files
don't match the libs I have or that my runtime environment is
different than what exists in the headers/libs.  The exact same code
runs perfectly on Windows and FreeBSD.

Looks like I need to build python from the source.  Following the
instructions on Mac/Demo/building.html I was unable to build it using
Codewarrior 6.1.  I know a fair amount about Codewarrior but was
unable to resolve all the errors which were being produced.  My guess
is that Jack is doing some magic here which isn't mentioned in the
docs.

The source at ftp.python.org appears to require the unix-type build
environment on OS X; the instructions are to run the configure script
and compile with the unix-type (GNU?) compiler using make.

>From what I understand, I must use the same compiler (same runtime
environment) to build both python and my target application if I wish
to embed python in the target application.

For political and practical reasons beyond my control, the target
application must use the Metrowerks compiler (I am not in charge of
the Mac builds, I'm just helping with the embedded python side of it).
Besides, to my knowledge the 'naked darwin' compiler is unable to
build a Carbon application anyway since resource forks and such are
needed.

All I need (I think) are the exact header files which were used to
build the Carbon libs which are available at the MacPython website, as
well as info on the precise build environment and settings.  Where can
I find this?  The good news is that it says the Carbon libs were built
with the Metrowerks compiler; I'll just make sure to use the exact
same version.

Is there anyone who has embedded Python into a Carbon app?  Is anyone
able to build Carbon-MacPython from sources?  Is it even recommended
to use Carbon MacPython in a professional product? i.e., would you say
Carbon MacPython is too experimental for this?

Any help would be appreciated.

--Matt



__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com