Posts

Showing posts with the label vala

Using custom C libraries with Vala

Using custom C libraries with Vala Lets try to use Vala with custom C libraries. For this example, lets see if we can use Vala to manilulate a gdbm database. Gdbm is a tiny db used in lots of applications. In order for a C library to work in Vala, it needs a .vapi file to translate. In this example, we will use the gdbm library (a small, common database in C)  using Vala bindings. There are two issues for new users here: Linking to C libraries in the C compiler Linking to vapi files in the Vala interpreter Youll see how to handle both. 1) Download the sources: Create a working directory Install the libgdbm-dev package, to get the c headers. I discovered a vapi file for gdbm created by Andre Masella. Thank you, Andre! Download and install the vapi file. Vapi files belong in /usr/share/vala/vapi/ Open a browser window to the Gnu GDBM documentation. $ mkdir /home/me/vala/gdbm_vala $ cd /home/me/vala/gdbm_vala # sudo apt-get install libgdbm-dev $ wget https://raw.github.com/apmasell/va...