Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/c-api/tests/component/instantiate.cc
3068 views
1
#include <gtest/gtest.h>
2
#include <wasmtime/component.hh>
3
#include <wasmtime/store.hh>
4
5
using namespace wasmtime::component;
6
7
TEST(component, instantiate) {
8
static constexpr auto bytes = std::string_view{
9
R"END(
10
(component
11
(core module)
12
)
13
)END",
14
};
15
16
wasmtime::Engine engine;
17
wasmtime::Store store(engine);
18
auto context = store.context();
19
Component component = Component::compile(engine, bytes).unwrap();
20
Linker linker(engine);
21
22
linker.instantiate(context, component).unwrap();
23
}
24
25