libghostty-vt 0.0.0
Loading...
Searching...
No Matches
Stability

libghostty-vt is extremely stable and production proven software.

It has been used by millions of users for years and is shipped in a diverse set of free and commercial software across every major operating system and mobile device. It is covered by a significant set of unit tests. It is fuzzed via an AFL++ harness on multiple dedicated machines 24/7, and we're continuously expanding our fuzz coverage.

Important
The one part that isn't fully stable yet is the C ABI. Prior to 1.0, we may change the C ABI. We believe all C ABI changes at this point are complete and plan to release a 1.0 tag soon, but we aren't promising it until we tag 1.0.

Checking the Version

Like any C library, libghostty-vt has two versions: the version you compile against and the version that is loaded at runtime. They're the same when statically linking, but can differ when dynamically linking and programs should be resilient to this.

To check the headers when compiling, use GHOSTTY_VT_VERSION_AT_LEAST(). It works in any #if, so you can also use it to enable code that needs a newer release:

// Stop the build if the headers are older than this program needs.
#if !GHOSTTY_VT_VERSION_AT_LEAST(0, 1, 0)
#error "libghostty-vt 0.1.0 or newer is required"
#endif

To read the library's version when your program runs, use ghostty_version() for the string and ghostty_build_info() for the numbers:

void print_library_version() {
// The full version, which is the easiest form to log or display. A
// development build has a suffix, such as "0.2.0-dev+abc1234".
printf("Library version: %s\n", ghostty_version());
// The same version as numbers, which is the easiest form to compare.
size_t major = 0;
size_t minor = 0;
size_t patch = 0;
printf("Library version numbers: %zu.%zu.%zu\n", major, minor, patch);
}

To make sure the two work together, compare them when your program starts:

// Returns true if the library loaded at runtime can be used with the
// headers this program was compiled against.
bool library_is_compatible() {
size_t major = 0;
size_t minor = 0;
// Until 1.0, any minor release may change the ABI, so the minor
// versions must match exactly.
return major == 0 && minor == GHOSTTY_VT_VERSION_MINOR;
}
// From 1.0, the major versions must match. The library may be newer
// than the headers but not older, because an older library is missing
// the functions that newer headers declare.
return major == GHOSTTY_VT_VERSION_MAJOR &&
}

Full program: c-vt-build-info/src/main.c

See Version for the version macros and more examples.