Skip to content

fix: use namespaced valtypes for compat with Extism #715 #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ int main(int argc, char *argv[]) {
};

std::vector<Function> functions = {
Function("hello_world", {ValType::I64}, {ValType::I64}, hello_world,
Function("hello_world", {ValType::ExtismValType_I64},
{ValType::ExtismValType_I64}, hello_world,
(void *)"Hello again!",
[](void *x) { std::cout << "Free user data" << std::endl; }),
};
Expand Down
2 changes: 1 addition & 1 deletion src/current_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ uint8_t *CurrentPlugin::inputBytes(size_t *length, size_t index) const {
return nullptr;
}
auto inp = this->inputs[index];
if (inp.t != ValType::I64) {
if (inp.t != ValType::ExtismValType_I64) {
return nullptr;
}
if (length != nullptr) {
Expand Down
4 changes: 2 additions & 2 deletions test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ TEST(Plugin, FunctionExists) {

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

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