[PyKDE] Help on wrapping a C library

Huaicai Mo huaicai at nanorex.com
Mon May 23 21:37:50 BST 2005


Roberto,

Thank you for the reply. Initially, I planned to use SWIG, which was used to
create the PyOpenGL package, but I read the article:
http://people.web.psi.ch/geus/talks/europython2004_geus.pdf	

It looks to me SIP has better performance, but I am not sure if that's only
true for C++? I didn't see any known packages wrapped by Pyrex, did you?

Huaicai

> -----Original Message-----
> From: Roberto Alsina [mailto:ralsina at kde.org]
> Sent: Monday, May 23, 2005 3:35 PM
> To: huaicai
> Subject: Re: [PyKDE] Help on wrapping a C library
> 
> Not to be annoying, but for C, Pyrex will probably be much easier.
> The big advantage of SIP is for C++.
> 
> > Hi all,
> >
> > I was trying to use SIP to wrap a C library GTS(gnu triangular surface).
> I
> > am new to the SIP tool, so before wrapping GTS, I am learning to wrap a
> > simple C libary just like the C example(word) in the SIP reference
> guide.
> >
> > I implemented the "Word" libary in C and a C test program works fine by
> > using the libary. I got a "segmentation fault" error when I call the
> > reverse() in python as follows:
> >               import word
> >               w = word.create_word("How are you?")
> >               print word.reverse(w)
> > I added another reverse function into the "word" library like: "char
> > *myReverse(const char *w);". It works fine in python when I do this:
> >               print word.myReverse("How are you?")
> >
> > Please see the C source/header file and SIP specification file in the
> > attachments. Can any one tell me what's wrong?
> >
> > Thank you very much! I really appreciate your help.
> >
> > Huaicai
> >
> > _______________________________________________
> > PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> > http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
> >
> 
> 
> --
>  ("\''/").__..-''"`-. .         Roberto Alsina
>  `9_ 9  )   `-. (    ).`-._.`)  ralsina at kde.org
>  (_Y_.)' ._   ) `._`.  " -.-'   KDE Developer (MFCH)
>   _..`-'_..-_/ /-'_.'
> (l)-'' ((i).' ((!.'             Buenos Aires - Argentina
> Imminentizing the eschaton since 1971.






More information about the PyQt mailing list