[Pythonmac-SIG] Loading modules on MacOS

Zhi Peng zhiyong_peng2003 at yahoo.com
Mon Oct 31 04:26:05 CET 2005


Jure
 
Could I ask you. With gcc compiler and linker, if the dylib name is module.dylib, can this dynamic library be used by C code that are developed by other C compiler such as CodeWarrior? 
 
 
Zhi 

jurem at flextronics.si wrote:
Hi all,
I'm porting some software from Linux/Python to MacOS/Python. Core modules
are written in C++ and are loaded in Python as modules.

On Linux those core modules are linked as shared libraries (.so). It looks
something like:

core_module1.so <-- 'standalone' core module, does not link any other lib
high_module2.so <-- higher level module which is using core_module1.so

Problem on MacOS is, that Python modules are bundles not shared libraries,
so I've made it like:

core_module1.dylib <-- dynamic library (using -dynamiclib gcc option)
core_module1.so <-- bundle, created from .dylib
high_module2.so <-- bundle, which also links .dylib

I'm symlinking core_module1.dylib to libcore_module1.dylib.
Link options for both bundles are:
-W1,-F. -bundle -framework Python -lstdc++ -L. -lcore_module1

If I create only core_module1.so (as bundle, without dynamic library) it
loads properly, but if I do it this way Python 'hangs' when I try to load
module. I'm using dlcompat library (Mach-O wrapper) for loading dynamic
library (dlopen, dlysm, ...) and it should work fine.

Python version is 2.3, GCC is 3.3 (if I try to compile it on Linux with
same versions works without problems)

Does anyone have any idea, what could be wrong? I think this would be the
cleanest way to port this software, am I wrong?

Thanks for any ideas/suggestions,

regards, Jure

_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG at python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

		
---------------------------------
 Yahoo! FareChase - Search multiple travel sites in one click.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051030/a60bc163/attachment.html


More information about the Pythonmac-SIG mailing list