MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / unsafeAddHostInstance

Method unsafeAddHostInstance

include/runtime/instance/module.h:490–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488 /// Unsafely add and export the existing instance to this module.
489 template <typename T, typename... Args>
490 std::enable_if_t<IsEntityV<T>, void>
491 unsafeAddHostInstance(std::string_view Name,
492 std::vector<std::unique_ptr<T>> &OwnedInstsVec,
493 std::vector<T *> &InstsVec,
494 std::map<std::string, T *, std::less<>> &InstsMap,
495 std::unique_ptr<T> &&Inst) {
496 OwnedInstsVec.push_back(std::move(Inst));
497 InstsVec.push_back(OwnedInstsVec.back().get());
498 InstsMap.insert_or_assign(std::string(Name), InstsVec.back());
499 }
500
501 /// Unsafely find and get the exported instance by name.
502 template <typename T>

Callers

nothing calls this directly

Calls 2

backMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected