Perhaps, you can pre-load the extension library when Python is invoked. It is probably trying.
Pre-loading is commonly done done for memory management and profiling libraries and it may (or may not) work for libraries including the Boehm-GC. And if it does work, call GC_INIT inside the initialization function of the extension library. The latter will be called just before Python's main is. If you are using the GNU C, writing the initialization function could be as simple as void __attribute__((constructor)) _initializer (void) /* any name */ { call GC_INIT(); } For more details, see <http://gcc.gnu.org/onlinedocs/gcc/Function- Attributes.html> under 'constructor'. Other compilers may support a #pragma like init for this purpose. Pre-loading a (shared) library on Linux is typically done using the env command, e.g.: $ env LD_PRELOAD=<path_to_the_library> python .... Some command shells support other ways and the name LD_PRELOAD may be different on other O/S's. HTH, /Jean Brouwers On Dec 25, 3:34 am, malkarouri <[EMAIL PROTECTED]> wrote: > Hi everyone, > > Is it possible to write a Python extension that uses the Boehm garbage > collector? > I have a C library written that makes use of boehm-gc for memory > management. To use that, I have to call GC_INIT() at the start of the > program that uses the library. Now I want to encapsulate the library > as a CPython extension. The question is really is that possible? And > will there be conflicts between the boehm-gc and Python memory > management? And when should I call GC_INIT? > > Best Regards, > > Muhammad Alkarouri -- http://mail.python.org/mailman/listinfo/python-list