This project demonstrates how to create a Go (golang) package from a c++ class using SWIG Read detailed instructions here: http://zacg.github.io/blog/2013/06/06/calling-c-plus-plus-code-from-go-with-swig/
#####Building
cd simplelib
make
#####Installing
make install
#####Clean
make cleanall
#####Running
package main
import (
"fmt"
"github.com/zacg/simplelib"
)
func main() {
simpleClass := simplelib.NewSimpleClass()
result := simpleClass.Hello()
fmt.Println(result)
strings := simplelib.NewStringVector()
simpleClass.HelloString(strings)
for i := 0; i < strings.Size(); i++ {
fmt.Println(strings.Get(i))
}
bytes := simplelib.NewByteVector()
simpleClass.HelloBytes(bytes)
for i := 0; i < bytes.Size(); i++ {
fmt.Printf("%s", string(bytes.Get(i)))
}
}