Skip to content
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

Can we run Javy compiled JS program with wasmer-go? #400

Open
royaljain opened this issue Oct 17, 2023 · 0 comments
Open

Can we run Javy compiled JS program with wasmer-go? #400

royaljain opened this issue Oct 17, 2023 · 0 comments
Labels
❓ question Further information is requested

Comments

@royaljain
Copy link

Summary

I'm trying to run a simple JS function, using Javy to compile the wasm file.

index.js

export function foo() {
    console.log("Hello from foo!");
}

index.wit

package local:main;

world index-world {
  export foo: func(); 
}

javy compile index.js --wit index.wit -n index-world -o index.wasm

main.go

var wasmBytes, _ = ioutil.ReadFile("index.wasm")

var engine = wasmer.NewEngine()
var store = wasmer.NewStore(engine)

var module, err = wasmer.NewModule(store, wasmBytes)

var importObject = wasmer.NewImportObject()
var instance, _ = wasmer.NewInstance(module, importObject)

var foo, _ = instance.Exports.GetFunction("foo")

Problem: Instance object is null.

Error: panic: runtime error: invalid memory address or nil pointer dereference

Can javy compiled wasm run with wasmer-go? Any leads on how to dig deeper also help!

Additional details

wasmer run -e foo index.wasm

This runs correctly.

@royaljain royaljain added the ❓ question Further information is requested label Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant