Re: [go-nuts] How to access pointer to pointer in cgo

2017-07-05 Thread Manohar Reddy
gt; > Did you assign something to the pointer? > > My guess is that you did not, because the code compiles and then fails at > runtime telling the pointer is NULL. > > On Wednesday, July 5, 2017 at 1:19:47 PM UTC+2, Manohar Reddy wrote: >> >> > fmt.Println(optional

Re: [go-nuts] How to access pointer to pointer in cgo

2017-07-05 Thread Manohar Reddy
UTC+5:30, Jan Mercl wrote: > > On Wed, Jul 5, 2017 at 1:04 PM Manohar Reddy > wrote: > > > fmt.Println(optional._32.Magic) // did not work for me: HOW TO ACCESS > MAGIC VARIABLE > > Who wants to guess what does "did not work for me" mean without having the &g

[go-nuts] How to access pointer to pointer in cgo

2017-07-05 Thread Manohar Reddy
These are the things I have in C. IMAGE_OPTIONAL_HEADER *pe_optional(pe_ctx_t *ctx); typedef struct { uint16_t Magic; }IMAGE_OPTIONAL_HEADER_32; typedef struct { uint16_t type; IMAGE_OPTIONAL_HEADER_32 *_32; }IMAGE_OPTIONAL_HEADER; In c language to access Magic variable, I did thi

[go-nuts] Explain the meaning of iota

2017-06-30 Thread Manohar Reddy
`iota` is golnag's enum. I've seen this code in Wikipedia. But I did not understand it. Can someone please explain this code? type ByteSize float64 const ( _ = iota // ignore first value by assigning to blank identifier KB ByteSize = 1 << (10 * iota) MB GB) -- You rece