diff --git a/lib/cli/src/commands/create_exe.rs b/lib/cli/src/commands/create_exe.rs index c9512cb2e..0f6a8bba3 100644 --- a/lib/cli/src/commands/create_exe.rs +++ b/lib/cli/src/commands/create_exe.rs @@ -701,10 +701,23 @@ fn link_c_compilation() -> Result<(), anyhow::Error> { Ok(()) } +#[allow(dead_code)] +fn generate_wasmer_main_c_static(entrypoint: &Entrypoint) -> Result { + generate_wasmer_main_c_inner(entrypoint, true) +} + +fn generate_wasmer_main_c(entrypoint: &Entrypoint) -> Result { + generate_wasmer_main_c_inner(entrypoint, false) +} + /// Generate the wasmer_main.c that links all object files together /// (depending on the object format / atoms number) -fn generate_wasmer_main_c(entrypoint: &Entrypoint) -> Result { +fn generate_wasmer_main_c_inner( + entrypoint: &Entrypoint, + compile_static: bool, +) -> Result { const WASMER_MAIN_C_SOURCE: &str = include_str!("wasmer_create_exe_main.c"); + const WASMER_STATIC_MAIN_C_SOURCE: &str = include_str!("wasmer_static_create_exe_main.c"); match entrypoint.object_format { ObjectFormat::Serialized => { @@ -732,22 +745,40 @@ fn generate_wasmer_main_c(entrypoint: &Entrypoint) -> Result