type SliceHeader struct {
Data uintptr
Len int
Cap int
}
type StringHeader struct {
Data uintptr
Len int
}
以上數據結構來源於package reflect
有了以上數據結構 就可以將從C malloc得到的內存轉換成Go slice和string使用
具體方法以後補充 如何將從C malloc到的unsafe.Pointer轉換爲Go內置數據結構
[1]http://blog.rqhut.net/article/[golang]數組、切片和字符串的內存結構
[2]http://my.oschina.net/lubia/blog/175154