You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package p
import "C"
//export F
func F(x *[10]C.int) {}
$ go build issue10889.go
# command-line-arguments
./issue10889.go:6:11: Go type not supported in export: [10]_Ctype_int
./issue10889.go:6:11: Go type not supported in export: [10]_Ctype_int
We can't support [10]_Ctype_int as argument, that's for sure, but why
can't we support *[10]_Ctype_int as argument?
I imagine one reason is probably that the C pointer to array layout and
Go's are incompatible, but I don't think that is the case today. Now people
need to resort to passing pointers to Go exported functions, but that also
assumes that the array layout is compatible between C and Go.
The text was updated successfully, but these errors were encountered:
C doesn't have array arguments nor pointer-to-array arguments. It just has pointers.
I suppose we could turn Go *[10]C.int into C int**, but there's already Go **C.int for that.
In general arrays in argument position are not well understood by most C programmers.
Given that there is already an equivalent syntax supported (plain pointers), I'm not inclined
to do anything here.
We can't support
[10]_Ctype_int
as argument, that's for sure, but whycan't we support
*[10]_Ctype_int
as argument?I imagine one reason is probably that the C pointer to array layout and
Go's are incompatible, but I don't think that is the case today. Now people
need to resort to passing pointers to Go exported functions, but that also
assumes that the array layout is compatible between C and Go.
The text was updated successfully, but these errors were encountered: