Re: [go-nuts] SIGSEGV with cgo

2018-01-31 Thread hǎi sū
thank you. andrey mirtchovski於 2018年1月31日星期三 UTC+8下午1時33分04秒寫道: > > on the Go side you have an array of bytes, on the C side you are > passing a pointer to an array of shorts (16-bits) > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsub

Re: [go-nuts] SIGSEGV with cgo

2018-01-31 Thread hǎi sū
thank you. now, I understand. Ian Lance Taylor於 2018年1月31日星期三 UTC+8下午1時29分09秒寫道: > > On Tue, Jan 30, 2018 at 9:13 PM, hǎi sū > > wrote: > > the code is below. > > ``` > > package main > > > > import "math/rand" > > import "fmt" > > > > /* > > #include > > #include > > > > void t(con

Re: [go-nuts] SIGSEGV with cgo

2018-01-30 Thread andrey mirtchovski
on the Go side you have an array of bytes, on the C side you are passing a pointer to an array of shorts (16-bits) -- 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

Re: [go-nuts] SIGSEGV with cgo

2018-01-30 Thread Ian Lance Taylor
On Tue, Jan 30, 2018 at 9:13 PM, hǎi sū wrote: > the code is below. > ``` > package main > > import "math/rand" > import "fmt" > > /* > #include > #include > > void t(const short *buf, size_t buf_size) { > printf("in t."); > printf("0: %d ", buf[0]); > printf("buf_size-1: %d\n", buf[buf_size-1])

[go-nuts] SIGSEGV with cgo

2018-01-30 Thread hǎi sū
the code is below. ``` package main import "math/rand" import "fmt" /* #include #include void t(const short *buf, size_t buf_size) { printf("in t."); printf("0: %d ", buf[0]); printf("buf_size-1: %d\n", buf[buf_size-1]); } */ import "C" func main() { for { a := make([]byte, 178209) rand.Read