you cannot pass a Go func to C function.
what you can do is exporting a Go function, and let a C function call it.
read golang.org/cmd/cgo for details.
unsupported C pointer types are translated to *[0]byte.
On Jan 30, 2014 7:48 AM, "Francesco Bochicchio" <bief...@gmail.com> wrote:
> Yes, I forgot to add the //export directive ... which in turn forced me to put the C code in a separate file ... but at the
> end it seems to work.
if your C code contains only tiny wrapper functions, you can still put in the same Go file and label them as static inline.
unsupported C pointer types are translated to *[0]byte.
if you cast the C function pointer to *[0]byte then it could be passed to a C function that takes a function pointer.
the choice of *[0]byte is not arbitrary, it means the same as void * in C.
the choice of *[0]byte is not arbitrary, it means the same as void * in C.