libghostty-vt 0.0.0
Loading...
Searching...
No Matches
Build Info

Find out how this copy of the library was built and which features it has. More...

Detailed Description

Find out how this copy of the library was built and which features it has.

Build info is what this copy of the library knows about how it was compiled: its version, its optimization mode, and which features it has.

You need this when your program has to adapt to the library it loaded, such as checking for Kitty graphics before you offer images. You don't need a terminal. These values are constant for the lifetime of the process, so you only have to read them once.

Example

bool simd = false;
GHOSTTY_API GhosttyResult ghostty_build_info(GhosttyBuildInfo data, void *out)
@ GHOSTTY_BUILD_INFO_SIMD
Definition build_info.h:69

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

To check the version of the headers rather than the library, see Version. To choose what a build contains, see Optional Features.

Enumerations

enum  GhosttyOptimizeMode
enum  GhosttyBuildInfo {
  GHOSTTY_BUILD_INFO_INVALID = 0 , GHOSTTY_BUILD_INFO_SIMD = 1 , GHOSTTY_BUILD_INFO_KITTY_GRAPHICS = 2 , GHOSTTY_BUILD_INFO_TMUX_CONTROL_MODE = 3 ,
  GHOSTTY_BUILD_INFO_OPTIMIZE = 4 , GHOSTTY_BUILD_INFO_VERSION_STRING = 5 , GHOSTTY_BUILD_INFO_VERSION_MAJOR = 6 , GHOSTTY_BUILD_INFO_VERSION_MINOR = 7 ,
  GHOSTTY_BUILD_INFO_VERSION_PATCH = 8 , GHOSTTY_BUILD_INFO_VERSION_PRE = 9 , GHOSTTY_BUILD_INFO_VERSION_BUILD = 10 , GHOSTTY_BUILD_INFO_FEATURE_SNAPSHOT = 11 ,
  GHOSTTY_BUILD_INFO_FEATURE_FORMATTER = 12 , GHOSTTY_BUILD_INFO_FEATURE_SELECTION = 13 , GHOSTTY_BUILD_INFO_FEATURE_SEARCH = 14 , GHOSTTY_BUILD_INFO_FEATURE_RENDER_STATE = 15 ,
  GHOSTTY_BUILD_INFO_FEATURE_INPUT_ENCODE = 16 , GHOSTTY_BUILD_INFO_FEATURE_COLOR = 17 , GHOSTTY_BUILD_INFO_FEATURE_GRID_INTROSPECTION = 18 , GHOSTTY_BUILD_INFO_FEATURE_GLYPH_PROTOCOL = 19 ,
  GHOSTTY_BUILD_INFO_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE
}

Functions

GHOSTTY_API GhosttyResult ghostty_build_info (GhosttyBuildInfo data, void *out)
GHOSTTY_API const char * ghostty_version (void)

Enumeration Type Documentation

◆ GhosttyBuildInfo

Build info data types that can be queried.

Each variant documents the expected output pointer type.

Enumerator
GHOSTTY_BUILD_INFO_INVALID 

Invalid data type. Never results in any data extraction.

GHOSTTY_BUILD_INFO_SIMD 

Whether SIMD-accelerated code paths are enabled.

Output type: bool *

GHOSTTY_BUILD_INFO_KITTY_GRAPHICS 

Whether this build includes the kitty_graphics feature, which provides the Kitty graphics protocol and the ghostty_kitty_graphics_* functions. It is always false on targets without an operating system, such as wasm32-freestanding. See Optional Features.

Output type: bool *

GHOSTTY_BUILD_INFO_TMUX_CONTROL_MODE 

Whether tmux control mode support is available.

Output type: bool *

GHOSTTY_BUILD_INFO_OPTIMIZE 

The optimization mode the library was built with.

Output type: GhosttyOptimizeMode *

GHOSTTY_BUILD_INFO_VERSION_STRING 

The full version string (e.g. "1.2.3" or "1.2.3-dev+abcdef").

Output type: GhosttyString *

GHOSTTY_BUILD_INFO_VERSION_MAJOR 

The major version number.

Output type: size_t *

GHOSTTY_BUILD_INFO_VERSION_MINOR 

The minor version number.

Output type: size_t *

GHOSTTY_BUILD_INFO_VERSION_PATCH 

The patch version number.

Output type: size_t *

GHOSTTY_BUILD_INFO_VERSION_PRE 

The pre metadata string (e.g. "alpha", "beta", "dev"). Has zero length if no pre metadata is present.

Output type: GhosttyString *

GHOSTTY_BUILD_INFO_VERSION_BUILD 

The build metadata string (e.g. commit hash). Has zero length if no build metadata is present.

Output type: GhosttyString *

GHOSTTY_BUILD_INFO_FEATURE_SNAPSHOT 

Whether this build includes the snapshot feature, which provides the ghostty_snapshot_* functions. See Optional Features.

Output type: bool *

GHOSTTY_BUILD_INFO_FEATURE_FORMATTER 

Whether this build includes the formatter feature, which provides the ghostty_formatter_* functions. See Optional Features.

Output type: bool *

GHOSTTY_BUILD_INFO_FEATURE_SELECTION 

Whether this build includes the selection feature, which provides the ghostty_terminal_select_*, ghostty_terminal_selection_* and ghostty_selection_gesture_* functions. See Optional Features.

Output type: bool *

GHOSTTY_BUILD_INFO_FEATURE_SEARCH 

Whether this build includes the search feature, which provides the ghostty_search_* functions. See Optional Features.

Output type: bool *

GHOSTTY_BUILD_INFO_FEATURE_RENDER_STATE 

Whether this build includes the render_state feature, which provides the ghostty_render_state_* functions. See Optional Features.

Output type: bool *

GHOSTTY_BUILD_INFO_FEATURE_INPUT_ENCODE 

Whether this build includes the input_encode feature, which provides the key, mouse, focus and paste encoding functions. See Optional Features for the full list.

Output type: bool *

GHOSTTY_BUILD_INFO_FEATURE_COLOR 

Whether this build includes the color feature, which provides the ghostty_color_* functions. See Optional Features.

Output type: bool *

GHOSTTY_BUILD_INFO_FEATURE_GRID_INTROSPECTION 

Whether this build includes the grid_introspection feature, which provides the ghostty_grid_ref_*, ghostty_tracked_grid_ref_*, ghostty_cell_get* and ghostty_row_get* functions. See Optional Features for the full list.

Output type: bool *

GHOSTTY_BUILD_INFO_FEATURE_GLYPH_PROTOCOL 

Whether this build includes the glyph_protocol feature, which lets applications register custom glyphs with Ghostty's glyph protocol. It has no functions of its own. See Optional Features.

Output type: bool *

Definition at line 60 of file build_info.h.

◆ GhosttyOptimizeMode

Build optimization mode.

Definition at line 47 of file build_info.h.

Function Documentation

◆ ghostty_build_info()

GHOSTTY_API GhosttyResult ghostty_build_info ( GhosttyBuildInfo data,
void * out )

Query a compile-time build configuration value.

You must pass a pointer to the correct output type for the requested data (see GhosttyBuildInfo variants for types).

void query_build_info() {
bool simd = false;
bool kitty_graphics = false;
bool tmux_control_mode = false;
printf("SIMD: %s\n", simd ? "enabled" : "disabled");
printf("Kitty graphics: %s\n", kitty_graphics ? "enabled" : "disabled");
printf("Tmux control mode: %s\n", tmux_control_mode ? "enabled" : "disabled");
GhosttyString version_string = {0};
size_t version_major = 0;
size_t version_minor = 0;
size_t version_patch = 0;
GhosttyString version_pre = {0};
GhosttyString version_build = {0};
printf("Version: %.*s\n", (int)version_string.len, version_string.ptr);
printf("Version major: %zu\n", version_major);
printf("Version minor: %zu\n", version_minor);
printf("Version patch: %zu\n", version_patch);
if (version_pre.len > 0) {
printf("Version pre : %.*s\n", (int)version_pre.len, version_pre.ptr);
} else {
printf("Version pre : (none)\n");
}
if (version_build.len > 0) {
printf("Version build: %.*s\n", (int)version_build.len, version_build.ptr);
} else {
printf("Version build: (none)\n");
}
}

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

Parameters
dataThe build info field to query
outPointer to store the result (type depends on data parameter)
Returns
GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if data is GHOSTTY_BUILD_INFO_INVALID, or GHOSTTY_UNSUPPORTED if data is not known to this version of the library
Examples
c-vt-build-info/src/main.c.

◆ ghostty_version()

GHOSTTY_API const char * ghostty_version ( void )

Get the full version of the library as a string.

This is the version of the library your program loaded, which can differ from the GHOSTTY_VT_VERSION of the headers it was compiled against. See Version for when that matters.

A release returns its version, such as "0.1.0". A development build also has a pre-release and build suffix, such as "0.2.0-dev+abc1234".

This returns the same text as GHOSTTY_BUILD_INFO_VERSION_STRING, but as a null-terminated string that you can pass straight to printf or to other languages. To get the version as numbers, use ghostty_build_info() with GHOSTTY_BUILD_INFO_VERSION_MAJOR and the values that follow it.

printf("Using libghostty-vt %s\n", ghostty_version());
GHOSTTY_API const char * ghostty_version(void)
Returns
The version string. It is never NULL, is owned by the library, and stays valid for as long as the library is loaded. Do not free it.
Examples
c-vt-build-info/src/main.c.