[Pythonmac-SIG] embedding -- linking problem?
john at compgeomco.com
Sun Nov 28 19:02:19 CET 2004
Consider me a newbie at both python and MacOS. All discussion below pertains to python-2.3.4 using gcc and g++ compilers on MacOSX10.3.
I configured python with ./configure --prefix=$PWD --exec-prefix=$PWD. Then I added a module in Modules/Setup and put the .c file in Modules. I built python and can import my module just fine. Next I wrote an app that calls Py_Initialize(), then PyRun_SimpleString("import mymodule\n").
To see what to add to my link line, I ran the python that I just built with:
What I got from this was:
'-u __dummy -u _PyMac_Error -framework System -framework CoreServices -framework Foundation'
So I put this in my Makefile and linked statically to the libpython2.3.a that I just built. It compiles fine with g++ but runs correctly ONLY if I have PATH set so that the directory for Python-2.3.4 comes first. Otherwise the app can't find mymodule. So the app isn't portable.
What am I missing?
(This same approach works correctly on linux except what I had to add to link there was '-Xlinker -export-dynamic'.)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pythonmac-SIG