Skip to main content

lumen_app_new_from_lmna

Function lumen_app_new_from_lmna 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn lumen_app_new_from_lmna( data: *const u8, len: usize, base_dir: *const c_char, ) -> *mut LumenApp
Expand description

Allocate a new app from prebuilt LMNA artifact bytes (ABI 0.7). data points to len bytes of a lumenc-compiled artifact (magic LMNA); Lumen copies them in immediately, so the caller may free data as soon as this returns. base_dir (UTF-8, NUL-terminated, or null) is the directory relative asset paths in the artifact resolve against; null means the current directory.

This is the link-not-embed launcher seam: the thin lumenc launcher compiles source to LMNA bytes in-process (it has the parser) and hands them here, so the runtime runs with NO parser and never touches a source file. Contrast lumen_app_new, which takes a source directory and parses via the bundled parser.

Returns null on error (null/empty data, or base_dir not UTF-8); call lumen_last_error for details. The artifact bytes themselves are validated lazily at run time (lumen_app_run / lumen_app_run_headless), where a bad magic / version surfaces as an error status.