CGO: void* pointer handling

I have C struct like that:

typedef struct {
void* data;
} foo;

I want to use CGO to copy it to equivalent go struct

type foo struct {
data unsafe.Pointer

but I get panic: runtime error: cgo argument has Go pointer to unpinned Go pointer
what should I do?

also, when I try to pin the data using runtime.Pinner it complains that data IS NOT go pointer…

How are you setting the data field before you pass it to C?

Ok, bug in pinner will be fixed in next go release

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