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

Allow libraries to export functions for the wasm host #2186

Open
spotandjake opened this issue Nov 2, 2024 · 0 comments
Open

Allow libraries to export functions for the wasm host #2186

spotandjake opened this issue Nov 2, 2024 · 0 comments
Labels

Comments

@spotandjake
Copy link
Member

I've noticed that while writing bindings or using component model there is a need for the library being consumed to be able to provide exports to the host, some examples include:

  • cabi_realloc - In the component model
  • grainboy - In grainboy we have to re-export functions for the event loop.

We should look into how we could improve this experience Ideally it would be nice if the consumer of the module could just include it without having to be aware of the low level things going on or the host exports, this poses some questions and challenges though such as what if you are using two libraries with the same exports, how can the user still maintain control over this. I think the most simple approach would be to re-export the functions and then have things closer to the main file in the dependency tree override if they share the same name, I don't think this approach would be ideal however as it does not handle every situation and offers little control and transparency. Maybe we could look into a way of having modules register foreign exports and then there needs to be some sort of acknowledgment of this on the include, I don't think either of these examples are great however so I think alternative ideas would be great to hear and maybe we can find something that would make sense in the language, whenever we get silo having a silo.toml file might provide a good place to handle this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant