bytecodealliance / bytecodealliance/go-modules
go:wasmexport: unsupported parameter type
- Lingua principale
- Go
- Stelle
- 148
- Fork
- 20
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Iniziate con il test collegato dei tipi di parametri supportati e non supportati in Go change 611315, quindi esaminate le firme wasmexport mostrate in questa issue. Convalidate qualsiasi direzione proposta tramite la configurazione del reactor host e una chiamata alla funzione esportata; il lavoro è completo quando i bindings interessati possono usare correttamente i tipi di parametri necessari.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- go, wasm
- Ambito
- compilers, devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 42/100