One way to work this around is to use https://github.com/mattn/go-pointer.
On Wed, Jan 29, 2020 at 2:12 PM <aotto1968z...@gmail.com> wrote: > 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 > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/5cfa2851-f81c-4a79-b526-619d064c0d39%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/5cfa2851-f81c-4a79-b526-619d064c0d39%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEd86Tyxu1jfQUHfjfU5b_63YMuSYPhjkDsb2OuY8pmL_VewTw%40mail.gmail.com.