1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! ABI version probe — bindings call [`kglite_abi_version`] on
//! startup and fail loudly if the runtime ABI's major version
//! doesn't match what they were compiled against.
/// The ABI version that this build of `kglite-c` exposes. Tracks
/// the engine crate's package version (semver minor-aligned).
const ABI_MAJOR: u32 = 0;
const ABI_MINOR: u32 = 10;
const ABI_PATCH: u32 = 5;
/// Return the C ABI version this library was built against.
/// Bindings should call this on startup and refuse to proceed if
/// the major version doesn't match what they were compiled
/// against — a mismatched major risks segfaults from changed
/// struct layouts or removed functions.
///
/// Conventions within a major version: additive only (new
/// functions, new status codes, new opaque types). Existing
/// function signatures and struct layouts never change.
///
/// # Examples
///
/// ```c
/// KgliteAbiVersion v = kglite_abi_version();
/// if (v.major != KGLITE_EXPECTED_MAJOR) {
/// fprintf(stderr, "kglite ABI mismatch: expected %u.x, got %u.%u.%u\n",
/// KGLITE_EXPECTED_MAJOR, v.major, v.minor, v.patch);
/// return 1;
/// }
/// ```
pub extern "C"