I am using SWIG to expose some C++ functions to Go with following commands:
gcc -std=c++0x -Wall -Wextra -pedantic -fPIC -shared -L./lib -lsomething -o example.so
swig -go -intgosize 32 example.i
go tool 6g example.go
go tool 6c -I /usr/lib/go/pkg/linux_amd64 -D_64BIT example_gc.c
go tool pack grc example.a example.6 example_gc.6
rm -f example_wrap.c
go install // this installs the generated .a; not the .so
For my project, I am using a /src:/pkg:/bin file structure, with $GOHOME pointing to it. When I use import "example"
in another Go package I get:
error while loading shared libraries: example.so: cannot open shared object file: No such file or directory
Where do I have to put the shared library, so that it will be found? Without messing around in system directories.