bytecodealliance / bytecodealliance/go-modules
go:wasmexport: unsupported parameter type
- Dominant language
- Go
- Stars
- 148
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
Work is being done in Go 1.24 to support go:wasmexport.
However, there are a handful of unsupported parameter types. The following test shows the supported and unsupported types https://go-review.googlesource.com/c/go/+/611315
*string, and *uint8 are examples I have run into with the current wit-bindgen-go bindings.
Is it a possible solution to use `unsafe.Pointer` and convert the parameters to their necessary types?
I.e
**Breaking**
```
//go:wasmexport count
//export count
func wasmexport_Count(s0 *uint8, s1 uint32, sub0 *uint8, sub1 uint32) (result0 uint32) {
s := cm.LiftString[string]((*uint8)(s0), (uint32)(s1))
sub := cm.LiftString[string]((*uint8)(sub0), (uint32)(sub1))
result := Exports.Count(s, sub)
result0 = (uint32)(result)
return
}
```
**Possible workaround**
```
//go:wasmexport count
//export count
func wasmexport_Count(s0 unsafe.Pointer, s1 uint32, sub0 unsafe.Pointer, sub1 uint32) (result0 uint32) {
s := cm.LiftString[string]((*uint8)(s0), (uint32)(s1))
sub := cm.LiftString[string]((*uint8)(sub0), (uint32)(sub1))
result := Exports.Count(s, sub)
result0 = (uint32)(result)
return
}
```
I am still working through a test to ensure this functionality works. I am currently working through the reactor host setup to call the exported function.
Contributor guide
Assessment
This issue has not been assessed yet.