Are there any examples of inter-module communication?
@Benjamin Brittain do you mean in terms of like linking instances together? Or are you looking for a specific example of something like "transfer memory from A to B"
"transfer memory from A to B"
Ah ok, we don't currently have an example of that, but I'll look into adding one!
are you interested in wasm modules themselves doing the copy? or the host doing the copy?
I'd love to see both actually!
but mostly the module themself
mk I'll see if I can whip something up today
that would be super fantastic :D
@Benjamin Brittain do you have a use case in mind? Otherwise I was thinking of maybe doing something like creating a module that has a "log" function and another module which calls that log function
and the original one like reverses the message or something weird like htat
no actual use case in mind yet. I'm just trying to get an understanding of the current state of things. Log would be a super example though
kk sounds good
@Benjamin Brittain https://github.com/bytecodealliance/wasmtime/pull/1369
This is fantastic! Exactly what I was looking for
@Alex Crichton I've tried to replicate the .wat
modules in rust code and linking is working great with basic data types. I also saw that in the module the memory was also imported. How could one module access other module's memory using, for example, rust? I've tried basically passing the pointers around but received attempt to multiply with overflow
errors..
I don't believe there are any mechanisms to do that right now
@daubaris it's pretty nontrivial to link two rust programs dyanmically at runtime like that together right now
it needs a lot of coordination of details like heap layout, stack, etc
C has dynamic linking story that's further along than Rust's for sure, we haven't put much effort into making it usable from rustc
you can probably get away with it with various flags and transformations though, but you'd be making a lot of it yourself
@Alex Crichton Oh, so it is not really feasible at the moment as I understand it. Alright thanks!
Last updated: Nov 22 2024 at 16:03 UTC