Re: [go-nuts] Re: callback for c code wrapper around go function

2017-12-21 Thread roupesy
No, I am talking about the function in the C preamble will they be part of the header and share object ? On Thursday, December 21, 2017 at 9:39:07 AM UTC-5, Ian Lance Taylor wrote: > > On Thu, Dec 21, 2017 at 6:15 AM, > wrote: > > > > 2 - Do all functions added into the preamble get exported t

Re: [go-nuts] Re: callback for c code wrapper around go function

2017-12-21 Thread roupesy
No I am not talking about the exported function, but the function from the C function within the preamble, and what about the first part of the question (scroll up) thank you On Thursday, December 21, 2017 at 9:39:07 AM UTC-5, Ian Lance Taylor wrote: > > On Thu, Dec 21, 2017 at 6:15 AM, > wrot

[go-nuts] Re: callback for c code wrapper around go function

2017-12-21 Thread roupesy
*I meant to say this error * # command-line-arguments duplicate symbol _parse in: $WORK/command-line-arguments/_obj/_cgo_export.o $WORK/command-line-arguments/_obj/one.cgo2.o ld: 1 duplicate symbol for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see

Re: [go-nuts] Re: callback for c code wrapper around go function

2017-12-21 Thread roupesy
Hey Ian, Thanks again for replying, however I'm a bit confused by the code you've provided. am I passing the go callback into that function ? I have few questions: 1- * I tried to do the do the following * /* #include #include void parse(char* err, int status) { // will get

[go-nuts] Re: callback for c code wrapper around go function

2017-12-19 Thread roupesy
Thanks for your response, are you referring to something like this: /* #include #include void parse(char* err, int status) { // do work } */ func Ccomputation(address *C.char) { ptr := uintptr(unsafe.Pointer(C.parse)) SomeGoComputation(C.GoString(address), func(errString stri

[go-nuts] callback for c code wrapper around go function

2017-12-18 Thread roupesy
Hey guys, I want to write a c wrapper around a go code that has a callback func SomeGoComputation(address string, callback func(string,int)) { _, err = // do some computation with address, maybe go over the network if (err != nil) { callback(err.Error(), 0) }