[Pythonmac-SIG] embedding -- linking problem? (original) (raw)
John Fowler john at compgeomco.com
Sun Nov 28 19:02:19 CET 2004
- Previous message: [Pythonmac-SIG] Python 2.3.4 Installation
- Next message: [Pythonmac-SIG] Problems with MacPython PackMan
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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:
import distutils.sysconfig distutils.sysconfig.get_config_var('LINKFORSHARED')
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'.)
Thanks,
John Fowler -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20041128/f97a3edd/attachment.html
- Previous message: [Pythonmac-SIG] Python 2.3.4 Installation
- Next message: [Pythonmac-SIG] Problems with MacPython PackMan
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]