At 06:11 PM 3/7/2008 -0800, Andi Vajda wrote: >If I want to support multiple Python extension modules built with >JCC to run in the same Python process and hence share the same Java >VM, there is some code between these modules that needs to be shared. > >Currently, the JCC runtime code (not much, really) is compiled into >each JCC-built extension module. There is one C++ class, JCCEnv, >that really needs to be shared among all JCC-built modules. Building >that class into a shared library (instead of a python module >library) could be to be the way to go. Then every such module would >be linked against this shared library. > >I gave this a quick manual try on Mac and it seems to work. > >But do distutils or setuptools have built-in ways of building a >regular shared library (in particular, on Mac OS X, a .dylib, not a >bundle) or is there some hacking needed there still ? (google shows >that there have been nibbles of interest over the past years about >this but it's unclear whether this was done or not). It would make >the JCC build considerably more complicated if I had to add >hand-crafted code for each and every platform/compiler that is >supported by JCC (that list is growing). Having a distutils or >setuptools way of building a regular shared library would be very >helpful here. Has support for that that been added yet ?
Not really, but there is some experimental code in the setuptools trunk, IIRC. If you look at the 'tests/test_shlib' subdirectory there is some sample code for building a shared library. I don't know if it works right on OS X... and there were some hairy things involved in doing it on Linux. Patches welcome. :) (Chances are good, though, that you'll be better off using the import + API struct approach to sharing stuff. IIRC, there are still a lot of hoops to jump through to get shared libs working on OS X and Linux.) _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig