dtolnay / watt

Runtime for executing procedural macros as WebAssembly
Apache License 2.0
1.29k stars 29 forks source link

Rework wasm entry point #27

Closed dtolnay closed 5 years ago

dtolnay commented 5 years ago
- #[proc_macro2::proc_macro]
- pub fn my_macro(input: TokenStream) -> TokenStream {
+ #[no_mangle]
+ pub extern "C" fn my_macro(input: TokenStream) -> TokenStream {

I feel that there is enough user-facing complexity going on in Watt that it's worth exposing the wasm entry point as a conceptually more straightforward single extern fn if at all possible, rather than a mysterious macro.

This requires committing to TokenStream being pointer-sized, which I am okay with (and happened to be the case already as of #22).