Skip to content

This project demonstrates how to let Go programs invoke statically linked C++ libraries without using SWIG.

Notifications You must be signed in to change notification settings

wangkuiyi/go-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Go-Cpp

This project demonstrates how to call C++ code from Go program without the need of using SWIG.

The basic idea is to write a C wrapper of C++ code, and use cgo to call this C wrapper.

Checkout and Build

git clone -b develop https://github.com/wangkuiyi/go-cpp
cd go-cpp/c++
scons
cd ../go
export GOPATH=`pwd`
cd src/go_prog
go install
DYLD_LIBRARY_PATH=$GOPATH/../c++/ $GOPATH/bin/go_prog

Note that you need to install SCons to build the C++ part. In order to install SCons on Mac OS X, you can use Homebrew.

If you are using Linux, the last command to run the demo program is:

LD_LIBRARY_PATH=$GOPATH/../c++/ $GOPATH/bin/go_prog

About

This project demonstrates how to let Go programs invoke statically linked C++ libraries without using SWIG.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published