Skip to content

GObject

Each release publishes the library for Linux with glibc as maplibre-native-ffi-gobject-linux-gnu-<arch>.tar.gz. It needs GLib 2.80 or later. Unpack it into the prefix of the C library:

Terminal window
tar -xzf maplibre-native-ffi-gobject-linux-gnu-x64.tar.gz -C <prefix>

On other platforms, build it from bindings/gobject into the prefix. This also needs gobject-introspection 1.80, Vala, and meson 1.3 or later:

Terminal window
export PKG_CONFIG_PATH=<prefix>/share/pkgconfig
meson setup build bindings/gobject --prefix=<prefix> --libdir=lib
meson install -C build

C programs include <maplibre-native-ffi.h> and link with pkg-config:

Terminal window
cc main.c $(pkg-config --cflags --libs maplibre-native-ffi-gobject-0) -o main

Vala programs read the VAPI from the prefix:

Terminal window
valac --vapidir=<prefix>/share/vala/vapi --pkg maplibre-native-ffi-gobject-0 main.vala

GJS and PyGObject load the typelib from <prefix>/lib/girepository-1.0, and other GObject language bindings read MaplibreNativeFfi-0.gir from <prefix>/share/gir-1.0. Unless the prefix is a system one, put those directories on GI_TYPELIB_PATH and XDG_DATA_DIRS, and <prefix>/lib on the library path:

main.js
import MaplibreNativeFfi from "gi://MaplibreNativeFfi?version=0";

Asynchronous calls finish on the thread-default main context of the thread that starts them, so that thread must run its main loop.