Re: [go-nuts] calling go functions from c

2016-10-03 Thread Ian Lance Taylor
On Sun, Oct 2, 2016 at 2:37 PM, wrote: >> There is some overhead when using gccgo, because of the need to >> interact with the Go scheduler. The overhead should be slightly less. > > > Any idea what (very rough is fine) that overhead is when compared to the > standard go toolchain? I've never m

Re: [go-nuts] calling go functions from c

2016-10-02 Thread webuser1200
> > There is some overhead when using gccgo, because of the need to > interact with the Go scheduler. The overhead should be slightly less. > Any idea what (very rough is fine) that overhead is when compared to the standard go toolchain? -- You received this message because you are sub

Re: [go-nuts] calling go functions from c

2016-10-01 Thread Ian Lance Taylor
On Sat, Oct 1, 2016 at 5:23 AM, web user wrote: > 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 no

Re: [go-nuts] calling go functions from c

2016-10-01 Thread Ian Lance Taylor
On Sat, Oct 1, 2016 at 5:17 AM, wrote: > > - I used the int and char C. directly in fmt.printf and it seemed to > work. Is that ok to do without having to convert into a native go type? Yes. > - What about c types like > > C short -> ? > C __int64 -> ? > > What file are all the go C. defined in

Re: [go-nuts] calling go functions from c

2016-10-01 Thread web user
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

Re: [go-nuts] calling go functions from c

2016-10-01 Thread webuser1200
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.do

Re: [go-nuts] calling go functions from c

2016-09-30 Thread Seb Binet
On Fri, Sep 30, 2016 at 7:42 AM, wrote: > Thanks for reading my question. I'm trying to map c to Go "C." > > 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 he

Re: [go-nuts] calling go functions from c

2016-09-29 Thread webuser1200
Thanks for reading my question. I'm trying to map c to Go "C." C int -> go C.int C unsigned char -> ? C char -> ? C unsigned short -> ? C double -> ? C __int64 -> ? C *char -> C.string On Friday, September 30, 2016 at 1:27:13 AM UTC-4, Ian Lance Taylor wrote: > > On Thu, Sep 29, 2016 at 8:59 PM

Re: [go-nuts] calling go functions from c

2016-09-29 Thread Ian Lance Taylor
On Thu, Sep 29, 2016 at 8:59 PM, wrote: > I have a basic example working of calling back into go from C. If I have a C > function as: > > func Add(a, b C.Int) C.Int { > return a + b > } > > Where is the mapping of C type to C. when I want to pass additional > types to Go : > > 1. Unsigned int > 2

[go-nuts] calling go functions from c

2016-09-29 Thread webuser1200
I have a basic example working of calling back into go from C. If I have a C function as: func Add(a, b C.Int) C.Int { return a + b } Where is the mapping of C type to C. when I want to pass additional types to Go : 1. Unsigned int 2. char 3. double 4. string 5. short etc... -- You received