I need to export a label pointing to a function like
(func $can_sayhello (export "can sayhello") (type $t3)
The closest I can get is:
(export "can_sayhello" (func $assembly/index/can_sayhello))
using this AssemblyScript
@external("can sayhello")
export declare function can_sayhello(): void;
What I really want to do is change the label of this function
function sayhello() : void {
}
//output in wat
(export "sayhello" (func $assembly/index/sayhello))
to be
(export "can sayhello" (func $assembly/index/sayhello))
I'm new to assembly script and I really cant figure this out, if you have any questions let me know.
It's pretty unusual for any language to have function names with spaces, but it is possible!
I wrote a simple transformation pass that allows you have any string for named exports.
It is here https://github.com/willemneal/visitor-as/blob/master/src/examples/exportAs.ts
You need to add
visitor-as
as a dependency for your project then either in yourasconfig.json
or cli add theexportAs
transformer.e.g.
Then compile like