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 <javascript:>> 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.