20#include <initializer_list>
28struct WASMModuleCommon;
29struct WASMModuleInstanceCommon;
35 void operator()(WASMModuleCommon* m)
const noexcept;
38 void operator()(WASMModuleInstanceCommon* m)
const noexcept;
41 void operator()(WASMExecEnv* e)
const noexcept;
44using WasmModulePtr = std::unique_ptr<WASMModuleCommon, WasmModuleDeleter>;
45using WasmInstancePtr = std::unique_ptr<WASMModuleInstanceCommon, WasmInstanceDeleter>;
74 [[nodiscard]]
bool callI(const
char*
name,
75 std::initializer_list<int32_t> args = {},
76 int32_t* out_i32 =
nullptr);
82 [[nodiscard]]
bool lastCallTrapped() const noexcept {
return last_call_trapped_; }
89 [[nodiscard]]
const std::string&
id() const noexcept {
return id_; }
92 return module_inst_ !=
nullptr;
114 [[nodiscard]]
const char*
trKey(
const char* key)
const noexcept;
121 struct OverlayEntry {
129 std::size_t bytecode_len_ = 0;
136 std::vector<OverlayEntry> langOverlay_;
137 std::string langOverlayLang_;
139 std::set<std::string> missingExports_;
141 bool last_call_trapped_ =
false;
142 char last_trap_[160] = {0};
In-memory representation of a plugin's meta.json.
char name[cdc::hal::ISecureElement::RMEM_NAME_LEN]
bool load(const std::string &id, const PluginManifest &manifest)
Load bytecode + instantiate the module. Does NOT run plugin_init yet - the manager handles ordering o...
std::vector< std::string > acquired_prereqs
bool hasExport(const char *name) const
const char * trKey(const char *key) const noexcept
Look up a plugin-local translation key in the loaded overlay.
bool lastCallTrapped() const noexcept
bool isLoaded() const noexcept
bool callI(const char *name, std::initializer_list< int32_t > args={}, int32_t *out_i32=nullptr)
Call an exported i32(i32...)->i32 function by name.
const char * lastTrapMessage() const noexcept
void unload() noexcept
Destroy WAMR instance + free bytecode buffer. Idempotent.
bool loadLangOverlay(const char *path=nullptr)
Load the plugin's translation overlay from disk into PSRAM.
const std::string & id() const noexcept
const PluginManifest & manifest() const noexcept
::cdc::core::PsramUniquePtr< T > PsramUniquePtr
std::unique_ptr< WASMExecEnv, WasmExecEnvDeleter > WasmExecEnvPtr
std::unique_ptr< WASMModuleCommon, WasmModuleDeleter > WasmModulePtr
std::unique_ptr< WASMModuleInstanceCommon, WasmInstanceDeleter > WasmInstancePtr
Thin alias layer that re-exports cdc::core RAII wrappers in the cdc::plugin_manager namespace for sou...
void operator()(WASMExecEnv *e) const noexcept
void operator()(WASMModuleInstanceCommon *m) const noexcept
void operator()(WASMModuleCommon *m) const noexcept