Error undefined for C types to go function

My function is taking several C char as parameters, but they show as undefined. I am importing C so not sure why.

package main

import "C"
import (
	"fmt"
	"github.com/99designs/keyring"
)

//export SetOsStore
func SetOsStore(serviceName *C.char, keyName *C.char, data *C.char) {
	ring, _ := keyring.Open(keyring.Config{
		ServiceName: serviceName,
	})
	_ = ring.Set(keyring.Item{
		Key:  keyName,
		Data: []byte(data),
	})
	i, _ := ring.Get(keyName)
	fmt.Printf("%s", i.Data)
}

func main() {}

Not sure how this works but in vscode there was a link above import C that said regenerate cgo definitions. I clicked on it and it worked.

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