title: Return array in Python from shared library built in Go
body: <p>I have the following Go file:</p>
  
  <pre><code>package main
  
  import "C"
  
  //export stringList
  func stringList(a, b string) []string {
          var parserString[] string
          parserString = append(parserString, a)
          parserString = append(parserString, b)
          return parserString
  }
  
  func main() {}
  </code></pre>
  
  <p>which I then build using <code>go build -o stringlist.so -buildmode=c-shared stringlist.go</code></p>
  
  <p>Then, I try to call it in Python using</p>
  
  <pre><code>from ctypes import *
  lib = cdll.LoadLibrary("./stringlist.so")
  lib.stringList.argtypes = [c_wchar_p, c_wchar_p]
  lib.stringList("hello", "world")
  </code></pre>
  
  <p>but receive the error</p>
  
  <pre><code>panic: runtime error: cgo result has Go pointer
  
  goroutine 17 [running, locked to thread]:
  main._cgoexpwrap_0de9d34d4a40_stringList.func1(0xc00005ce90)
      _cgo_gotypes.go:46 +0x5c
  main._cgoexpwrap_0de9d34d4a40_stringList(0x7f9fdfa8eec0, 0x7f9fddaffab0, 0x7f9fdd8f46cf, 0x7ffc501ce460, 0xc00000e040, 0x2, 0x2)
      _cgo_gotypes.go:48 +0x11b
  Aborted (core dumped)
  </code></pre>
  
  <p>What is the problem? How can I fix it? Is <code>stringList</code> not returning a proper type? </p>