Hi,
I try to use a C library with GO and have a small problem passing a GO pointer through C into a GO callback.
If I set: "export GODEBUG=cgocheck=0" everything works fine but without I get the error from above
Detail: I want to pass "
argv" through
C back to
GO, the lifetime of the
argv is only the lifetime of the
Send function call
// PROBLEM: [ErrorCatch] runtime error: cgo argument has Go pointer to Go pointer
// SOLVE: export GODEBUG=cgocheck=0
func (this *MqC) Send (callSig string, argv ...interface{}) {
hdl := this.getCTX()
callSig_ptr := (C.MQ_CST)(C.CString(callSig))
defer C.free((unsafe.Pointer)(callSig_ptr))
var errVal C.enum_MqErrorE = C.gomsgque_Send(hdl, callSig_ptr, C.MQ_INT(len(argv)), unsafe.Pointer(&argv))
if (errVal > C.MQ_CONTINUE) { MqErrorC_Check(C.MQ_MNG(hdl), errVal) }
}
The callback is:
//export atomSet
func atomSet( hdl C.MQ_MNG, objv unsafe.Pointer, skip C.MQ_INT, typ C.enum_MqSendE,
inP unsafe.Pointer) C.enum_MqErrorE {
ifc := (*(*[]interface{})(objv))[skip]
...
}
so, what is the GO solution for pass-through problem.
thanks… mfg ao