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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
use c_char;
use LazyLock;
const VERSION: &str = concat!;
const VERSION_PRE: &str = concat!;
static VERSION_MAJOR: = new;
static VERSION_MINOR: = new;
static VERSION_PATCH: = new;
/// Get the version of the Wasmer C API.
///
/// The `.h` files already define variables like `WASMER_VERSION*`,
/// but if this file is unreachable, one can use this function to
/// retrieve the full semver version of the Wasmer C API.
///
/// The returned string is statically allocated. It must _not_ be
/// freed!
///
/// # Example
///
/// See the module's documentation.
pub unsafe extern "C"
/// Get the major version of the Wasmer C API.
///
/// See [`wasmer_version`] to learn more.
///
/// # Example
///
/// ```rust
/// # use wasmer_inline_c::assert_c;
/// # fn main() {
/// # (assert_c! {
/// # #include "tests/wasmer.h"
/// #
/// int main() {
/// // Get and print the version components.
/// uint8_t version_major = wasmer_version_major();
/// uint8_t version_minor = wasmer_version_minor();
/// uint8_t version_patch = wasmer_version_patch();
///
/// printf("%d.%d.%d", version_major, version_minor, version_patch);
///
/// return 0;
/// }
/// # })
/// # .success()
/// # .stdout(
/// # format!(
/// # "{}.{}.{}",
/// # env!("CARGO_PKG_VERSION_MAJOR"),
/// # env!("CARGO_PKG_VERSION_MINOR"),
/// # env!("CARGO_PKG_VERSION_PATCH")
/// # )
/// # );
/// # }
/// ```
pub unsafe extern "C"
/// Get the minor version of the Wasmer C API.
///
/// See [`wasmer_version_major`] to learn more and get an example.
pub unsafe extern "C"
/// Get the patch version of the Wasmer C API.
///
/// See [`wasmer_version_major`] to learn more and get an example.
pub unsafe extern "C"
/// Get the minor version of the Wasmer C API.
///
/// See [`wasmer_version_major`] to learn more.
///
/// The returned string is statically allocated. It must _not_ be
/// freed!
///
/// # Example
///
/// ```rust
/// # use wasmer_inline_c::assert_c;
/// # fn main() {
/// # (assert_c! {
/// # #include "tests/wasmer.h"
/// #
/// int main() {
/// // Get and print the pre version.
/// const char* version_pre = wasmer_version_pre();
/// printf("%s", version_pre);
///
/// // No need to free the string. It's statically allocated on
/// // the Rust side.
///
/// return 0;
/// }
/// # })
/// # .success()
/// # .stdout(env!("CARGO_PKG_VERSION_PRE"));
/// # }
/// ```
pub unsafe extern "C"