Git Product home page Git Product logo

Comments (4)

sunfishcode avatar sunfishcode commented on July 21, 2024

There is a subtlety here: at the time when the wasm start function is called, code outside the module cannot access the module's exports. So if the wasm start function calls some code that expects to be able to call back into the wasm, it won't work. It remains an open question whether such cyclic dependency patterns should be supported in wasm. The WASI libc uses an exported function named _start right now, instead of a wasm start function, to avoid these issues.

from lucet.

kanaka avatar kanaka commented on July 21, 2024

@sunfishcode ah, because the start function is intended to be called during instantiation of the module right? That makes sense. So I guess the real issue is that lucet is throwing an exception when "_start" isn't exported whereas wasmtime is not (or it is but is swallowing the exception). Also, perhaps a different name than "_start" so it doesn't get as easily confused with the start function (like it did for me)? "_main" or "_entry" perhaps?

from lucet.

sunfishcode avatar sunfishcode commented on July 21, 2024

I agree, _start is confusing. I filed WebAssembly/WASI#19 to track changing the name.

from lucet.

acfoltzer avatar acfoltzer commented on July 21, 2024

I'm going to close this for now; we'll be sure to adapt what lucet-wasi does to match the behavior that results from the WebAssembly/WASI#19 discussion. Until then, we will need to keep the current behavior of running the wasm start function on instantiation, and then calling an exported _start function for the main program.

from lucet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.