On Fri, Jun 17, 2016 at 12:18 PM, Andrey Salnikov <and...@breakoutcommerce.com> wrote: > > But actually I don't understand how to receive context inside callback from > C-code. May be I'm wrong here but as I understand you mean that I have to > identify instance of *A using callback parameters received from C-side. But > what about if I'll receive only sum of two arguments a+b, I don't know the > result until I'll receive it from C-side and I don't know which instance > should be called if callback receive ex: 10 - should it be an instance which > handle 5+5 or another one used for 2+8.
If I understand you correctly, you are saying that you have a *A on the Go side, and you want it to call C code, and you want the C code to call back into Go, and when you call back you want to have the same *A you started with. If that is accurate, then one way or another you need pass the *A from Go to C. There is no magic way that you can call into C and then back to Go and somehow know which *A you had to begin with, any more than you could do it if you called from Go to Go without passing the *A. Ian -- 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. For more options, visit https://groups.google.com/d/optout.