title: golang struct with C struct in CGO
body: <p>I will use cgo to wrap one c library as go library for the project usage. I read the document, it seems there are lots of rules while using cgo. I don't know whether this is legal or not. </p>
  
  <p>Both LibCtx and Client is a struct in C. Is this a legal way to put C struct into a golang struct?</p>
  
  <pre><code>//DBClientLib.go
  
  type DBClient struct {
      Libctx C.LibCtx
      LibClient C.Client
  }
  
  func (client DBClient) GetEntry(key string) interface{} {
  
      //...
  }
  </code></pre>