Compile C code to shared library
shlib.RdCalls R CMD SHLIB to create the model's shared library.
Arguments
- file
the c file that is to be compiled, OR an ODE/CME object with a c.file defined and recorded in it.
Details
The first argument can be a raw character scalar with just the path of the c code to be compiled, or alternatively an object that has this information stored within it. The models returned by as_cme and as_ode can both carry this information, attach it via c_path<-.
Examples
m <- model_from_tsv(uqsa_example("AKAR4"))
o <- as_ode(m)
C <- generate_code(o)
c_path(o) <- write_c_code(C)
so_path(o) <- shlib(o)
print(o)
#> Model name : AKAR4
#> C file : /tmp/RtmpgX4tEN/adf9204aaf2748b8/AKAR4.c [2026-05-04 10:58:40.84713]
#> shared library : /tmp/RtmpgX4tEN/adf9204aaf2748b8/AKAR4.so [2026-05-04 10:58:40.84713]
#> Number of state variables : 2
#> Number of parameters : 5
#> Number of outputs : 1
#> Conservation laws : 2
#> Transformations : no
if (file.exists(so_path(o))) cat("shared library exists.\n")
#> shared library exists.