second-state / wasmedge-bindgen

Let WebAssembly's exported function support more data types for its parameters and return values.
Apache License 2.0
29 stars 8 forks source link

Make "allocate" configurable #11

Open abourget opened 1 year ago

abourget commented 1 year ago

It would be nice to be able to customize the "allocate" export name. TinyGo for instance, generates a function called "malloc" instead of "allocate". Perhaps auto-detect, if "allocate" and/or "malloc" exists in the module exports even.

I tried with:

func (b *Bindgen) SetAllocateExport(funcName string) {
    b.allocateFunc = funcName
}

and a new Bindgen variable called allocatedFunc it worked for TinyGo.

If you're open to a contribution, let me know.