Skip to content

Declared in <galanthus/c_api/gln_capi.h>.

GLN_API gln_status_t GLN_CALL gln_init_runtime(
    const gln_init_options_t* in_options_or_null,
    gln_error_t*              out_error);
  • Family: Core lifecycle
  • Return type: gln_status_t

Purpose

Initializes process-wide Galanthus C ABI runtime state.

Call this before opening backends, creating file-backed stores, or running operations that depend on runtime configuration.

Return

Returns GLN_OK on success and a non-OK gln_status_t value on failure.

TypeNullabilityOwnership
gln_status_tvaluevalue

Parameters

NameDirectionTypeNullabilityOwnership
in_options_or_nullinputconst gln_init_options_t*nullableborrowed
out_erroroutputgln_error_t*nullablecaller_allocated_output

Options

Pass NULL for in_options_or_null to use the current defaults, or initialize a gln_init_options_t with gln_default_init_options before filling fields.

On an initialization attempt before the runtime is already initialized, supplied options must have struct_size == sizeof(gln_init_options_t). A mismatch returns GLN_ERR_INVALID_ARG through the status boundary.

log_level defaults to 1. plugin_dir_or_null, dump_dir_or_null, and log_file_path_or_null are optional strings; NULL or an empty string means the field is absent at the options layer.

Path options take precedence over environment variables. If an option field is absent, plugin_dir_or_null falls back to GALANTHUS_PLUGIN_PATH, dump_dir_or_null falls back to GALANTHUS_DUMP_DIR, and log_file_path_or_null falls back to GALANTHUS_LOG_FILE.

Lifecycle

A successful first call records the resolved process state and opens the configured log file path when one is available.

Opening the log file is best-effort; if the file cannot be opened, initialization still succeeds and logging falls back to stderr.

Repeat calls after successful initialization are idempotent and return GLN_OK without applying new options.

Call gln_shutdown_runtime when the process is done with the library to tear down this process-wide state.

See Also