Overview
Software developers working with GObject Introspection often need a straightforward way to audit compiled binary typelib files. The gi-inspect-typelib utility provides a native command-line interface for querying API definitions, symbol structures, and dependency graphs directly from your terminal shell. In this hands-on walkthrough, we cover everything from provisioning prerequisite toolchains to dissecting pre-installed system bindings and building a custom typelib from scratch.
Setting Up GObject Introspection Tools on Ubuntu
Before querying binary typelib data, make sure your Ubuntu environment has the GObject Introspection development suite and basic runtime libraries installed.

Verify that the inspection binary was placed correctly into your system path using which.

The gi-inspect-typelib executable scans compiled typelib binaries and dumps their exposed internal schema and interfaces.
⚙️ [Essential CLI Flags]
-h, --help : Displays a reference list of available CLI arguments and runtime switches.--version : Reports the installed version release string.--print-shlibs : Lists linked shared object libraries required by the typelib.--print-typelibs : Recursively dumps imported dependency typelib namespaces.

Locating and Querying Pre-Installed System Typelibs
System-wide typelib repositories reside inside standard architecture-specific library directories. List the primary repository contents to view available compiled namespaces:

Query the default core metadata registry for the GLib namespace to display all registered interfaces and definitions:

Similarly, invoke the tool against the Gio namespace to explore APIs responsible for system I/O, IPC, and networking:

Targeting Specific Typelib Paths and Extracting Detailed Symbols
When inspecting arbitrary or isolated files, pass an explicit filesystem path directly to the command. First, locate the physical binary on disk:

Supply the retrieved file location directly to gi-inspect-typelib and pipe the output into grep to filter for high-level declarations such as functions, classes, and records:

To narrow down the output to a specific data structure—such as GLib’s configuration parser KeyFile—use context-aware pattern matching:

Building and Inspecting a Custom Typelib from Source
To observe the full compilation and introspection lifecycle, prepare an isolated workspace under /tmp:

Author a minimal C implementation containing an exported mathematical helper function, sample_calc:

Compile the source code into a dynamic shared library with position-independent code enabled:

Extract API signatures from the shared library and source files into an intermediate XML-based GIR manifest using g-ir-scanner:

Convert the human-readable GIR file into an optimized, binary typelib format via g-ir-compiler:

Finally, configure the search path to include your local directory and inspect the generated custom typelib to verify exported symbols:

Through this workflow, you can rapidly audit foreign function bindings, inspect exported symbols, and troubleshoot runtime binding issues across any GObject-based development environment in Linux.