javy_plugin_api

Function compile_src

Source
#[export_name = "compile_src"]
pub unsafe extern "C" fn compile_src(
    js_src_ptr: *const u8,
    js_src_len: usize,
) -> *const u32
Expand description

Compiles JS source code to QuickJS bytecode.

Returns a pointer to a buffer containing a 32-bit pointer to the bytecode byte array and the u32 length of the bytecode byte array.

§Arguments

  • js_src_ptr - A pointer to the start of a byte array containing UTF-8 JS source code
  • js_src_len - The length of the byte array containing JS source code

§Safety

  • js_src_ptr must reference a valid array of unsigned bytes of js_src_len length