On 30-okt-2005, at 8:06, [EMAIL PROTECTED] 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
Why not build libcore_module1.dylib as one would normally do (and I haven't done that yet, so can't help you there, -dynamiclib seems to be the right way). Then use distutils to build the extensions, that way the exentions get build how they should be. > > 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. What do you mean by 'hangs'? I suppose your script stops executing when it hits the import statement, but the quotes make me curious. Ronald > > 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@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig