I am writing a cgo wrapper.
The C function which I need to call looks like
int my_c_func (void *obj, const char *name, int64_t val, int search_flags);
My wrppper function in golang looks like below:
func (ctx *Context) AvOptionSetInt(key string, value int64, flags int) int {
Ckey := C.CString(key)
defer C.free(unsafe.Pointer(Ckey))
return (int)(C.my_c_func((*C.void)((unsafe.Pointer)(ctx.priv_data)), Ckey, (C.int64_t)(value), C.int(flags)))
}
I am getting following error.
cannot use cgo0 (type *_Ctype_void) as type unsafe.Pointer in argument to Cfunc_my_c_func
I understand that golang does not have void * in golang but it is just typecasting to a C data structure.Can you please help me solve this problem?