Re: [go-nuts] export struct method to C-code as callback (cgo-related)

2016-06-17 Thread andrey mirtchovski
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

Re: [go-nuts] export struct method to C-code as callback (cgo-related)

2016-06-17 Thread Andrey Salnikov
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

[go-nuts] export struct method to C-code as callback (cgo-related)

2016-06-17 Thread andrey
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