We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go version
go version go1.10.3 darwin/amd64
Yes
go env
GOARCH="amd64" GOBIN="" GOCACHE="/Users/Andari/Library/Caches/go-build" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/Andari/go" GORACE="" GOROOT="/usr/local/Cellar/go/1.10.3/libexec" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.10.3/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" CGO_ENABLED="1" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/lw/5pzww_8n38g1lv_kqqmqfvqr0000gn/T/go-build228325343=/tmp/go-build -gno-record-gcc-switches -fno-common"
I was experimenting with C interfacing:
... // export goadd func goadd(a int, b int) int { return a + b + 10 } ...
I built it with go build -buildmode=c-archive GoAdd.go I linked the resulted archive together with a C++ program.
go build -buildmode=c-archive GoAdd.go
The function to be callable from C++ code.
... extern "C" int goadd(int, int); ... std::cout << goadd(100, 100) << std::endl; ...
The program did not link. The space between the // and export had to be removed.
//
export
The text was updated successfully, but these errors were encountered:
This is working as intended. Requiring that there be no space reduces the chance of confusion with a real comment.
Sorry, something went wrong.
No branches or pull requests
What version of Go are you using (
go version
)?go version go1.10.3 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/Andari/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/Andari/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10.3/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/lw/5pzww_8n38g1lv_kqqmqfvqr0000gn/T/go-build228325343=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
I was experimenting with C interfacing:
I built it with
go build -buildmode=c-archive GoAdd.go
I linked the resulted archive together with a C++ program.
What did you expect to see?
The function to be callable from C++ code.
What did you see instead?
The program did not link.
The space between the
//
andexport
had to be removed.The text was updated successfully, but these errors were encountered: