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
// Conventions shared by every shim in this crate.
//
// `ext_shim`, `mtp_shim`, `chat_shim` and `common_shim` all wrap C++-only
// llama.cpp APIs behind `extern "C"`. They agree on two things, and both live
// here so they cannot drift apart:
//
// * one status enum, so a caller does not have to remember which shim's
// `-2` means "bad JSON" and which means "it threw";
// * one error buffer, so `llama_shim_last_error()` is always the detail for
// whatever call just failed, whichever shim it was in.
//
// The C++ helpers that implement those conventions live in
// `shim_support_impl.hpp`, which is not part of the bindgen surface.
extern "C" __cplusplus
}