Skip to content

Commit 3ebf810

Browse files
authored
fix: use namespaced valtypes for compat with Extism #715 (#18)
1 parent fd09b0d commit 3ebf810

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Diff for: example.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ int main(int argc, char *argv[]) {
3131
};
3232

3333
std::vector<Function> functions = {
34-
Function("hello_world", {ValType::I64}, {ValType::I64}, hello_world,
34+
Function("hello_world", {ValType::ExtismValType_I64},
35+
{ValType::ExtismValType_I64}, hello_world,
3536
(void *)"Hello again!",
3637
[](void *x) { std::cout << "Free user data" << std::endl; }),
3738
};

Diff for: src/current_plugin.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ uint8_t *CurrentPlugin::inputBytes(size_t *length, size_t index) const {
4545
return nullptr;
4646
}
4747
auto inp = this->inputs[index];
48-
if (inp.t != ValType::I64) {
48+
if (inp.t != ValType::ExtismValType_I64) {
4949
return nullptr;
5050
}
5151
if (length != nullptr) {

Diff for: test/test.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ TEST(Plugin, FunctionExists) {
6666

6767
TEST(Plugin, HostFunction) {
6868
auto wasm = read("../wasm/code-functions.wasm");
69-
auto t = std::vector<ValType>{ValType::I64};
69+
auto t = std::vector<ValType>{ValType::ExtismValType_I64};
7070
Function hello_world =
7171
Function("hello_world", t, t, [](CurrentPlugin plugin, void *user_data) {
7272
plugin.output(std::string("test"));
@@ -88,7 +88,7 @@ void callThread(Plugin *plugin) {
8888

8989
TEST(Plugin, MultipleThreads) {
9090
auto wasm = read("../wasm/code-functions.wasm");
91-
auto t = std::vector<ValType>{ValType::I64};
91+
auto t = std::vector<ValType>{ValType::ExtismValType_I64};
9292
Function hello_world =
9393
Function("hello_world", t, t, [](CurrentPlugin plugin, void *user_data) {
9494
plugin.output(std::string("testing123"));

0 commit comments

Comments
 (0)