On Mon, 2003-11-10 at 22:52, [EMAIL PROTECTED] wrote:
> Hi,
> a few days ago, I've got a great help on gtk<->pygtk objects wrapping. 
> Thanks a lot. 
> 
> Now, I have the library but the application crashes on segfault. I've been 
> thinking it is problem of mine or problem of Python but PyGtk seems to have 
> own part of this too. 
> 
> My program looks like: 
> 
> /* python setup */
> ...
> Py_Initialize();
> ... 
> 
> /* module setup */
> initcavfs(); // init C extension - module cavfs
> initpywrap(); // init C extension - module pywrap 
> 
> /* While cavfs does just Py_InitModule("cavfs", cavfs_methods); */ 
> 
> Now, on init_gobject() or "import gtk" I get a segfault which ALWAYS leads 
> to a stack trace similar to: 
> 
> #0  0x4d8b07f3 in strrchr () from /lib/libc.so.6
> #1  in cavfs_methods()
> #2  in init_gobject()
> loading /usr/lib/python2.2/site-packages/gtk-2.0/libgobject.so
> ... 
> 
> Please, note that cavfs_methods is a variable of type PyMethodDef. There's 
> no such method and it isn't referenced elsewhere! Compiled library contains 
> cavfs_methods pointer in a data part not code part. 

Maybe I am not understanding your problem, because this seems pretty
simple: you passed in cavfs_methods to the Py_InitModule() call for
cavfs (as you mentioned in your post). The second argument to
Py_InitModule() is a pointer to a structure array containing, amongst
other things, pointers to the functions which are the methods in the
cavfs module.

So you do refer to cavfs_methods in your code. If you do not
subsequently define it, it is not suprising that things go wrong. Have a
look at both the extending and embedding Python documentation and the
Python/C API documentation at python.org. They discuss what needs to go
into this array in more detail.

Cheers,
Malcolm

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to