The API calls
duk_dump_function()
and
duk_load_function()
allow
calling C code to (1) serialize an Ecmascript function into a portable
bytecode and then (2) load the bytecode to reconstitute the function.
The bytecode format is Duktape version specific and it's unsafe to load bytecode from a different Duktape minor version (patch version doesn't affect bytecode compatibility). Duktape configuration options may also affect bytecode compatibility, so dump/load source and target must be compiled with the same options. The bytecode format is platform neutral so that you can compile bytecode on one platform and then load it on another, which is useful for cross-platform builds. Duktape does not validate loaded bytecode so calling code must ensure bytecode is intact and valid for the running Duktape version.
See bytecode.rst for more details.