On a side not. The functions I call will from c into go will be called very frequently and the overhead of a callback from c might become an issue. I've heard that overhead can be as high as 200ns. Couple of questions:
1. Is the overhead not there when using gccgo? 2. What is the current state of gccgo support? Does it fully support 1.7 on linux? 3. Would the command that I currently use: go build -buildmode c-archive -o libgolang.a be the same on gccgo? On Sat, Oct 1, 2016 at 8:17 AM, <webuser1...@gmail.com> wrote: > Thanks for putting this together. I was trying to figure out how to do > callback from c to go. There are fewer examples on the web for that since > most of them deal with calling c code from go. > > C int -> go C.int > C unsigned char -> C.uchar > C char -> C.char > C unsigned int -> C.uint > C double -> C.double > C *char -> *C.char > > To get a go string from *C.char I used C.GoString(symbol). > > Couple of followup questions: > > - I used the int and char C.<type> directly in fmt.printf and it seemed to > work. Is that ok to do without having to convert into a native go type? > - What about c types like > > C short -> ? > C __int64 -> ? > > What file are all the go C.<types> defined in. > > Thanks to the go team for making this. It's so easy to work with the > binary c lib that I have and I'm actually going to enjoy it... > > On Friday, September 30, 2016 at 3:52:55 AM UTC-4, Sebastien Binet wrote: >> >> >> >> On Fri, Sep 30, 2016 at 7:42 AM, <webus...@gmail.com> wrote: >> >>> Thanks for reading my question. I'm trying to map c <type> to Go >>> "C.<type>" >>> >>> C int -> go C.int >>> C unsigned char -> ? >>> C char -> ? >>> C unsigned short -> ? >>> C double -> ? >>> C __int64 -> ? >>> C *char -> C.string >>> >> >> this won't work from within the playground, but here you go: >> >> https://play.golang.org/p/JgaDms1XMB >> >> hth, >> -s >> >> -- 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. For more options, visit https://groups.google.com/d/optout.