1#[cfg(target_arch = "wasm32")]
4use dlmalloc::GlobalDlmalloc;
5
6#[cfg(not(any(
7 feature = "external",
8 feature = "external-dynamic",
9 feature = "diffsl-cranelift",
10 feature = "diffsl-llvm"
11)))]
12compile_error!(
13 "diffsol-c requires one of `external`, `external-dynamic`, `diffsl-cranelift`, or `diffsl-llvm`."
14);
15
16#[cfg(target_arch = "wasm32")]
17#[global_allocator]
18static ALLOCATOR: GlobalDlmalloc = GlobalDlmalloc;
19
20#[cfg(all(feature = "diffsl-llvm15", feature = "diffsl-llvm16"))]
21compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
22#[cfg(all(feature = "diffsl-llvm15", feature = "diffsl-llvm17"))]
23compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
24#[cfg(all(feature = "diffsl-llvm15", feature = "diffsl-llvm18"))]
25compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
26#[cfg(all(feature = "diffsl-llvm15", feature = "diffsl-llvm19"))]
27compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
28#[cfg(all(feature = "diffsl-llvm15", feature = "diffsl-llvm20"))]
29compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
30#[cfg(all(feature = "diffsl-llvm15", feature = "diffsl-llvm21"))]
31compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
32#[cfg(all(feature = "diffsl-llvm16", feature = "diffsl-llvm17"))]
33compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
34#[cfg(all(feature = "diffsl-llvm16", feature = "diffsl-llvm18"))]
35compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
36#[cfg(all(feature = "diffsl-llvm16", feature = "diffsl-llvm19"))]
37compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
38#[cfg(all(feature = "diffsl-llvm16", feature = "diffsl-llvm20"))]
39compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
40#[cfg(all(feature = "diffsl-llvm16", feature = "diffsl-llvm21"))]
41compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
42#[cfg(all(feature = "diffsl-llvm17", feature = "diffsl-llvm18"))]
43compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
44#[cfg(all(feature = "diffsl-llvm17", feature = "diffsl-llvm19"))]
45compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
46#[cfg(all(feature = "diffsl-llvm17", feature = "diffsl-llvm20"))]
47compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
48#[cfg(all(feature = "diffsl-llvm17", feature = "diffsl-llvm21"))]
49compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
50#[cfg(all(feature = "diffsl-llvm18", feature = "diffsl-llvm19"))]
51compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
52#[cfg(all(feature = "diffsl-llvm18", feature = "diffsl-llvm20"))]
53compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
54#[cfg(all(feature = "diffsl-llvm18", feature = "diffsl-llvm21"))]
55compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
56#[cfg(all(feature = "diffsl-llvm19", feature = "diffsl-llvm20"))]
57compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
58#[cfg(all(feature = "diffsl-llvm19", feature = "diffsl-llvm21"))]
59compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
60#[cfg(all(feature = "diffsl-llvm20", feature = "diffsl-llvm21"))]
61compile_error!("diffsol-c cannot enable more than one `diffsl-llvm*` feature.");
62
63pub mod adjoint_checkpoint;
64pub mod c_api_utils;
65pub mod error;
66#[path = "error_c.rs"]
67pub mod error_c;
68pub mod host_array;
69#[path = "host_array_c.rs"]
70pub mod host_array_c;
71pub mod initial_condition_options;
72#[path = "initial_condition_options_c.rs"]
73pub mod initial_condition_options_c;
74pub mod jit;
75#[path = "jit_c.rs"]
76pub mod jit_c;
77pub mod linear_solver_type;
78#[path = "linear_solver_type_c.rs"]
79pub mod linear_solver_type_c;
80pub mod matrix_type;
81#[path = "matrix_type_c.rs"]
82pub mod matrix_type_c;
83pub mod ode;
84#[path = "ode_c.rs"]
85pub mod ode_c;
86pub mod ode_options;
87#[path = "ode_options_c.rs"]
88pub mod ode_options_c;
89mod ode_solver_tag;
90pub mod ode_solver_type;
91#[path = "ode_solver_type_c.rs"]
92pub mod ode_solver_type_c;
93pub mod scalar_type;
94#[path = "scalar_type_c.rs"]
95pub mod scalar_type_c;
96pub mod solution;
97pub mod solution_wrapper;
98#[path = "solution_wrapper_c.rs"]
99pub mod solution_wrapper_c;
100pub mod solve;
101pub mod solve_macros;
102mod solve_serialization;
103#[path = "string_c.rs"]
104pub mod string_c;
105pub mod utils;
106pub mod valid_linear_solver;
107
108#[cfg(test)]
109mod test_support;
110
111pub mod solver {
117 pub fn initialize() -> i32 {
119 42
120 }
121}
122
123pub use adjoint_checkpoint::AdjointCheckpointWrapper;
124pub use error::DiffsolRtError;
125pub use initial_condition_options::InitialConditionSolverOptions;
126pub use jit::{default_enabled_jit_backend, JitBackendType};
127pub use linear_solver_type::LinearSolverType;
128pub use matrix_type::MatrixType;
129pub use ode::OdeWrapper;
130pub use ode_options::OdeSolverOptions;
131pub use ode_solver_type::OdeSolverType;
132pub use scalar_type::ScalarType;
133pub use solution_wrapper::SolutionWrapper;
134
135#[cfg(test)]
136mod solver_tests {
137 use super::solver;
138
139 #[test]
140 fn verify_initialization() {
141 let output = solver::initialize();
142 assert_eq!(output, 42);
143 }
144}