I need to pass unknown Go struct to C++ code and iterate over struct fields in C++. Is it possible to reflect Go struct in C++ code (called from go via cgo)?
Lets assume I have a struct
type Zuzu struct {
name string
age float32
arr []int
}
I create an instance of this struct and pass it to C++ code:
var x = &Zuzu{}
function_cpp( x ) // call C++ code
The function_cpp()
must be able to "traverse" the x and get access to each type and each member of the Zuzu
instance pointed by x
without the prior knowledge of the Zuzu
type.