Georg Grabler wrote: > There's a C library which i'd like to have python bindings for. I havn't > known anything before about how to write python bindings for a C library. > > I succeeded now by using distutils to write the first bindings for functions > and similar. > > Now, it seems as something is blocking my brain. For the library, i > need "custom" types, so types defined in this library (structures), > including pointers and similar. > > I've been thinking about what i will need to represent this lists in python. > I thought about creating an external python object, providing "information" > i get from the list in C structures which can be converted. > > Basically, it are list of packages, which have several attributes (next, > prev, etc). But i don't know how to supply a proper list from the binding / > object written in C. > > Any suggestions or hints about this?
Use Pyrex. It's a Python-like language that was designed to write extension modules in C and it's great for writing wrappers. http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/ An example wrapper is described here: http://ldots.org/pyrex-guide/ Hope it helps, Stefan -- http://mail.python.org/mailman/listinfo/python-list