If the library made no provision for the caller to give a unique token
which would help to identify it in the callback then that library does
not expect to have more than one caller-and-callback in play at any
one time, or, even worse, expects you to arrange some thread-local
storage in the caller
On Fri, Jun 17, 2016 at 12:18 PM, Andrey Salnikov
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
Hi Andrey! thanks for answer!
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
I doubt that the cgo_callback method has the type the C library
desires. from https://golang.org/ref/spec#Method_declarations:
The type of a method is the type of a function with the
receiver as first argument.
I.e., the type of cgo_callback is func(a *A, ...).
The solution is to have
Hello,
Could you guys please help me.
I can't find how to export method function which belongs to some go-struct
to C-code (cgo part) as callback. I know how to export simple function
which not belongs to any type and use it as callback for C-function, but is
it possibly to export method of c