title: Passing a struct containing *byte to Syscall and read its content after execution
body: <p>I'm using <code>syscall.Syscall(...)</code> to call a C method in a dll.</p>
  
  <hr>
  
  <p>This is the C method signature:</p>
  
  <pre><code>SENSEI_API HSENSEI SENSEI_open(const char* sensigrafo, const char* options, SENSEI_ERR* se);
  </code></pre>
  
  <p>This is the <code>SENSEI_ERR</code> struct:</p>
  
  <pre><code>typedef struct
  {
      int code;
      char* error_string;
  } SENSEI_ERR;
  </code></pre>
  
  <hr>
  
  <p>In my GO program I declared a struct:</p>
  
  <pre><code>type senseiErr struct {
      code         int
      error_string *byte
  }
  </code></pre>
  
  <p>And tried to call the method:</p>
  
  <pre><code>    var nargs uintptr = 3
      var err senseiErr
  
      ret, _, callErr := syscall.Syscall(uintptr(senseiOpen),
          nargs,
          uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr("en"))),
          uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(""))),
          uintptr(unsafe.Pointer(&amp;err)),
      )
  </code></pre>
  
  <p>As you may have guessed, the <code>SENSEI_open</code> method fill the <code>SENSEI_ERR</code> argument with the code and the text of the error.</p>
  
  <p>Now I need to read the content of that error.</p>
  
  <p><code>err.code</code> actually has the correct value.</p>
  
  <p>About <code>err.error_string</code> I don't know. I'm new to GO and i have some questions:</p>
  
  <ul>
  <li>Since the C struct has the field <code>char* error_string</code>, is <code>error_string *byte</code> in my GO struct correct?
  
  <ul>
  <li>Should I use <code>[]byte</code> or something else?</li>
  </ul></li>
  <li>How do I read the content of the <code>error_string</code> field?
  
  <ul>
  <li><code>fmt.Println(err.error_string)</code> prints the memory address</li>
  <li><code>fmt.Println(*err.error_string)</code> prints always "101"</li>
  </ul></li>
  </ul>