Hello everybody,

I want to access some functions from the gdk_pixbuf c-library  to serialize and 
deserialize a GdkPixdata struct, which
is stored in f-spot's database.

I tried to marshal the c-structs and c-function calls with ctypes, but my 
application crashes with a segmentation fault signal

Any clue what's wrong?


from ctypes.util import find_library
from ctypes import *

class GdkPixdata(Structure):
    _fields_ = [ 
        ("magic",c_uint),
        ("length",c_int),
        ("pixdata",c_uint ),
        ("rowstride", c_uint),
        ("width", c_uint),
        ("height", c_uint), 
        ("pixel_data", POINTER(c_ubyte)),
    ]   

class GError(Structure):
    _fields_ = [ 
        ("domain", c_uint),
        ("code", c_int),
        ("message", c_char_p),
    ]  


pixlib =  CDLL(find_library('gdk_pixbuf-2.0'))
pixdata = GdkPixdata()
err = GError()

pixbuf
= pixlib.gdk_pixdata_deserialize(byref(pixdata), len(tag.icon),
tag.icon, POINTER(err)) #tag.icon contains the string from f-spot's db


Regards

Babi


      __________________________________________________________
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com
_______________________________________________
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