@Alex Crichton, a question about references: if I'm writing Rust and compiling to wasm32 and I want a certain function to be added as an element in a funcref table, what is the cleanest way to do that?
@fitzgen (he/him) mentioned using the function as a function pointer in some non-dead code... any other way? An attribute of some kind?
it would be cool if there were #[put_in_wasm_function_table]
but I kinda suspect there isn't anything like that
@Andrew Brown there's no programmatic way to do that sort of, but all indirectly-called functions will be there. So if you return a function pointer, for example, in an exported function then that it'll be in the funcref table
The second question is how then to export the table? I think the answer is to get the --export-table
flag to lld somehow--what is the best way to do that?
I think it's probably through RUSTFLAGS=-Clink-args=--export-table
or something like that
Last updated: Dec 23 2024 at 12:05 UTC