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 c_api_utils;
64pub mod error;
65#[path = "error_c.rs"]
66pub mod error_c;
67pub mod host_array;
68#[path = "host_array_c.rs"]
69pub mod host_array_c;
70pub mod initial_condition_options;
71#[path = "initial_condition_options_c.rs"]
72pub mod initial_condition_options_c;
73pub mod jit;
74#[path = "jit_c.rs"]
75pub mod jit_c;
76pub mod linear_solver_type;
77#[path = "linear_solver_type_c.rs"]
78pub mod linear_solver_type_c;
79pub mod matrix_type;
80#[path = "matrix_type_c.rs"]
81pub mod matrix_type_c;
82pub mod ode;
83#[path = "ode_c.rs"]
84pub mod ode_c;
85pub mod ode_options;
86#[path = "ode_options_c.rs"]
87pub mod ode_options_c;
88pub mod ode_solver_type;
89#[path = "ode_solver_type_c.rs"]
90pub mod ode_solver_type_c;
91pub mod scalar_type;
92#[path = "scalar_type_c.rs"]
93pub mod scalar_type_c;
94pub mod solution;
95pub mod solution_wrapper;
96#[path = "solution_wrapper_c.rs"]
97pub mod solution_wrapper_c;
98pub mod solve;
99pub mod solve_macros;
100mod solve_serialization;
101#[path = "string_c.rs"]
102pub mod string_c;
103pub mod utils;
104pub mod valid_linear_solver;
105
106#[cfg(test)]
107mod test_support;
108
109pub mod solver {
115 pub fn initialize() -> i32 {
117 42
118 }
119}
120
121pub use error::DiffsolRtError;
122pub use initial_condition_options::InitialConditionSolverOptions;
123pub use jit::{default_enabled_jit_backend, JitBackendType};
124pub use linear_solver_type::LinearSolverType;
125pub use matrix_type::MatrixType;
126pub use ode::OdeWrapper;
127pub use ode_options::OdeSolverOptions;
128pub use ode_solver_type::OdeSolverType;
129pub use scalar_type::ScalarType;
130pub use solution_wrapper::SolutionWrapper;
131
132#[cfg(test)]
133mod solver_tests {
134 use super::solver;
135
136 #[test]
137 fn verify_initialization() {
138 let output = solver::initialize();
139 assert_eq!(output, 42);
140 }
141}