PyMaemo/Accessing APIs without Python bindings

This is an on-going document, and will be linked on the PyMaemo main page once finished

Introduction

There are many libraries written in C that do not have native Python bindings yet. In Maemo, one of such libraries is libabook, used to manipulate the address book on Maemo devices.

While a full binding is still very useful, in most cases you need to use just a couple of functions and data structures to get your work done. Instead of waiting for a binding to be implemented, you can use Python's "ctypes" module, which allows to directly call functions and access data structures from C libraries.

This article will explain how to do call C library functions using ctypes, using libabook as an example. Most of the code snippets were based on code found on the "Hermes"[1]


Cite error: <ref> tags exist, but no <references/> tag was found