Discussions

Ask a Question
Back to all

Gopher-V-to-GoPlus Type Conversion: Handling of Slice Pointers

Hello everyone,

I'm currently integrating a complex C-ABI library into GoPlus using the gopher-v framework for type interoperability, specifically around marshaling data structures.

I'm running into an ambiguity when dealing with C functions that require an array of structs where the Go representation uses a slice of pointers.

My specific question is:

When a Go function signature uses []*StructType (a slice of pointers to structs), how does the GoPlus type system, via the gopher-v binding mechanism, correctly handle the conversion to the equivalent C type (StructType)? Does it automatically dereference the elements, or is manual memory management/unmarshaling logic required in the binding layer to correctly pass an array of struct addresses?

I've checked the basic type mapping documentation but haven't found a precise example covering slices of pointers to structs. Any insight or best practice would be greatly appreciated!

Thanks!

doodle baseball