Hi Andrey,

I am new to Go and cgo therefore did not exactly understand your point.
Can you explain me in the context of the code that I had posted.It will
really help me to get hold of the things much better.

Thanks,
Nitish

On Wed, Jul 10, 2019 at 5:19 PM andrey mirtchovski <mirtchov...@gmail.com>
wrote:

> what i do is have a similar struct in Go, and the original C one. here
> 'callbacks' is the go one, and
> "type Engine C.struct_cl_engine" is the opaque C one:
>
> https://github.com/mirtchovski/clamav/blob/master/callback.go#L63
>
> On Wed, Jul 10, 2019 at 5:25 AM Nitish Saboo <nitish.sabo...@gmail.com>
> wrote:
> >
> > Hi Andrey,
> >
> > I understand the issue here but how can I pass a callback function in a
> struct to C code.I need a struct because I want to pass and an extra
> parameter 'userdata' as well that I would require back as part of callback.
> >
> > Thanks,
> > Nitish
> >
> > On Wed, Jul 10, 2019 at 4:39 PM andrey mirtchovski <
> mirtchov...@gmail.com> wrote:
> >>
> >> i don't think you can use a go function directly in the callback. you
> >> need a correctly-typed C helper to do it. at least that used to be the
> >> case. see examples:
> >>
> >> https://github.com/mirtchovski/clamav/blob/master/cfuncs.go
> >> https://github.com/mirtchovski/clamav/blob/master/callback.go
>

-- 
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/CALjMrq7VF%2BdzSM7XFoqyWZ9qSa140X5N17FMt7VaCH%2B0EXnoxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to