Stream: git-wasmtime

Topic: wasmtime / issue #5266 Calculate host address issue?


view this post on Zulip Wasmtime GitHub notifications bot (Nov 15 2022 at 00:33):

alexthomas1 opened issue #5266:

I am trying to calculate the host address and I found a similar issue: #2547

However, it seems like wasmtime_linker_instantiate takes in type wasmtime_instance_t, but this isn't compatible with wasm_instance_exports. Is there an updated way to get the base pointer of a module using linker? Thank you.

wasm_instance_t* wasm_instance;
    error = wasmtime_linker_instantiate(linker, module, &wasm_instance, &trap);
    if (error != NULL || trap != NULL)
    {
        printf("Failed to instantiate \n");
        exit(1);
    }

wasm_extern_vec_t exports;
    wasm_instance_exports(wasm_instance, &exports);
    size_t i = 0;
    g_memory = get_export_memory(&exports, i++);

    // Run it.
    wasm_func_t* func;
    wasmtime_linker_get_default(linker, &empty, &func);
    if (error != NULL)
        exit_with_error("failed to locate default export for module", error, NULL);
    error = wasmtime_func_call(func, NULL, 0, NULL, 0, &trap);
    if (error != NULL)
        exit_with_error("error calling default export", error, trap);

Last updated: Oct 23 2024 at 20:03 UTC