Stephen Langer wrote: >On Thu, May 16, 2002 at 12:30:42AM +0800, James Henstridge wrote: > > >>In one of the source files for your module you must not define >>NO_IMPORT_PYGTK (all others, you should define it). You would then need >>to copy the contents of the init_pygtk() macro to your code and fix the >>C++ cast problem. >> >>The idea is that in the main file, you include pygtk.h, and call >>init_pygtk(). In the other files, you define NO_IMPORT_PYGTK before >>including pygtk.h. >> >> >> > > >Thanks. I was confused about whether NO_IMPORT_PYGTK should be >undefined once per shared library or once per application. Once per >application makes no sense when you think about it, I guess. > As far as you are concerned, the only symbols your extension module shares with other extension modules are the ones in the standard Python C API. Python extensions are loaded without the RTLD_GLOBAL flag, so their global symbols do not get put in the global symbol table[1]. This is why we have the pygtk.h header, to essentially import the symbols through the python C API (and potentially load the gtk module if it hasn't already been done).
James. [1] - The Red Hat packages of python were patched to set RTLD_GLOBAL when loading modules. This was done because it meant that running "import gtk" would not put GTK's symbols in the global symbol table. Some incorrectly linked modules (such as themes, imlib image loaders, and gdk-pixbuf image loaders) would expect these symbols to be available and throw a dynamic linking error if they weren't. You should not rely on this though. This is also the reason badly linked GTK themes don't work in mozilla (this isn't very visible anymore, as they hardly ever use native widgets anymore). -- Email: [EMAIL PROTECTED] | Linux.conf.au 2003 Call for Papers out WWW: http://www.daa.com.au/~james/ | http://conf.linux.org.au/cfp.html _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/