Shared library in golang

I am trying to create a shared library (libname.so) in golang using following command
go build -buildmode c-shared -o testlib.so test.go where test.go contains below code

package main
import “C”
type person struct {
name string
age int
}
//export newPerson
func newPerson(name string) *person {
p := person{name: name}
p.age = 42

return &p

}
func main(){}

It’s giving an error “Go type not supported in export: struct”

Can someone help?

See https://github.com/golang/go/issues/18412#issuecomment-268847417

Does this mean that I cannot create a shared library in golang where the library’s function takes any structure as argument?

If Yes then will it be supported in future?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.