I've recently announced a new open source project where client libraries
will be in C (and are mostly written) and I intend to write the central
server code in python.
http://linux-ha.org/source-doc/assimilation/html/index.html
Now that I'm actually starting to write that code, I've realized how
much work it will be to do this with ctypes (I knew before I suppose,
but I'd been ignoring it). I've used SWIG before, and since I'm using
ctypes, perhaps it won't be as hard to get going as I remember...
I prototyped a little code using ctypesgen and it's not bad. I wrote
some Pythonic class wrappers for the C-classes (classes in C), and the
first simple Python class I created wasn't large and unwieldy or
unmaintainable - it was quite reasonable.
My questions come to these:
When will there be official "releases" of ctypesgen?
Is ctypesgen going to go on and become a long-term production
project/product?
How stable/usable is ctypesgen at this point?
--
Alan Robertson<al...@unix.sh>
"Openness is the foundation and preservative of friendship... Let me
claim from you at all times your undisguised opinions." - William
Wilberforce
ctypesgen is a better option for me than either manually creating the
ctypes binding or using swig. Easier for deployment and development.
Obviously I can only speak for me :-)
I guess the answers to the first 2 depend on new users and new
contributors. I only started hacking on this as a few things didn't
work for me out of the box (i.e. scratching my own itch) which is
probably the case for other people too.
RE stable/usable - I've not had any problems with stability.
Usability was pretty clear for me, things didn't work until fixed BUT
they failed noisily rather than silently so they were easy to detect.
I think SWIG may have a better solution to a single code base
supporting both 32 bit and 64 bit targets BUT I've not had to deal
with that yet (only been dealing with 32 bit). Because ctypesgen
currently pre-processes (well GCC does) the headers you end up with
binding for that platform bit-age. I think we need more people banging
on it to work out the kinks.
When ever I need to work with a dll I think in terms of ctypesgen
rather than manual ctypes or even swig. swig is very cool (and has
saved me a bunch of work), and it supports other backends, but for me
ctypesgen is the better option for Python. It would be kind of neat to
have libFFI output for more than just Python/ctypes though (e..g. Java
support).
My first SWIG project took about a day to get started with subsequent
tweaking. ctypesgen was a few hours including patching ctypesgen for
some Windows support! So I think you've made a good decision to go the
ctypes root. You still have to deal with some ctype'isms but you do
not need to rebuild the bindings unless the C code changes. With swig
I often had to change the swig bindings (which requires a rebuild)
even if the C code was the same.
Chris