[Baypiggies] Opinions on Pyrex vs. ctypes vs. SWIG and whatever else binds to dynamic/shared libs
bsergean at gmail.com
Tue Dec 30 19:50:44 CET 2008
Yep, SIP is used to create the python binding around the big (lots of code)
Qt library. I think there is also a solution from Boost.
On Tue, Dec 30, 2008 at 10:32 AM, Andy Wiggin <andywiggin at gmail.com> wrote:
> It's been a long time since I did this myself, but another wrapper
> generator to consider, and the one I used, is SIP (
> http://www.riverbankcomputing.com/software/sip/intro ). As I remember
> you basically provide it with a simplified C/C++ header file, and it
> takes care of the rest. It worked very well for me, where I was
> creating bindings for a few dozen fairly simple C++ classes in order
> to do cross-platform GUI programming in Python.
> On Mon, Dec 29, 2008 at 12:23 PM, nar <nar at hush.com> wrote:
> > Hi guys,
> > Long time lurker, first time poster -- I've got a question that has been
> > bugging me for a while and I figured I'd roll it out here to see what
> > opinions people may have.
> > I've done a bit of work with Python binding to DLLs on Windows and shared
> > libraries on Linux/OSX, but I've mostly taken the ctypes route using
> > to generate wrapper code for me. It would seem that most cheese shop
> > use Pyrex with hand coded wrappers or SWIG to half auto-gen the wrappers
> > finish off with hand fix-ups.
> > Since ctypes ships with Python I kind of assumed it would be the
> > way of performing this task, but most people seem to like Pyrex and a
> > minority of people seem to use SWIG but hate it.
> > I suspect the question is similar to asking 'Which is better, vi or
> > but I'd like to hear what other people are doing / have done and why they
> > prefer it?
> > For those unfamiliar with ctypes / ctypeslib here's the process:
> > 0) Install gccxml
> > 1) Install ctypeslib module if it's not on your system, this will put
> > h2xml.py and xml2py.py on your system
> > 2) h2xml.py -I/path/to/includes SomeIncludeFile.h -o SomeIncludeFile.xml
> > 3) xml2py.py SomeIncludeFile.xml -o NewPythonModule.py
> > There's a bit of fiddling you can do with the h2xml stuff as far as
> > preprocessing, but that's roughly what it takes. You still need to
> > the generated wrapper code to make it 'pythonic' if thats your flavor,
> > it passes C-type variables in and out, but it still seems like a better
> > development flow than using Pyrex/SWIG, but there may be factors I'm
> > of. (Which is why I'm asking here!)
> > Hopefully this isn't too off topic for the list, I look forward to the
> > responses,
> > Thanks!
> > Nathan Ramella
> > nar <> @ <> hush.com
> > _______________________________________________
> > Baypiggies mailing list
> > Baypiggies at python.org
> > To change your subscription options or unsubscribe:
> > http://mail.python.org/mailman/listinfo/baypiggies
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Baypiggies