The test.bash file generates .so file using gcc, builds the executable
using the go tool and then run it with the $LD_LIBRARY_PATH variable
pointing to the directory where the .so file lives.
Fixes #2982.
R=rsc, remyoudompheng
CC=golang-dev
https://golang.org/cl/
5788043
doc/articles/wiki/*.bin
misc/cgo/life/run.out
misc/cgo/stdio/run.out
+misc/cgo/testso/testso
misc/dashboard/builder/builder
misc/goplay/goplay
misc/osx/*.pkg
+++ /dev/null
-# Copyright 2011 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-include ../../../src/Make.inc
-
-TARG=cgosotest
-
-CGO_DEPS+=libcgoso.so
-CGO_LDFLAGS+=-lcgoso -L.
-CLEANFILES+=out libcgoso.so
-CGOFILES=\
- cgoso.go\
-
-include ../../../src/Make.pkg
-
-libcgoso.so: cgoso_c.c
- gcc cgoso_c.c -fPIC -o $@ $(_CGO_CFLAGS_$(GOARCH)) $(_CGO_LDFLAGS_$(GOOS))
-
-out: install main.go
- $(GC) $(GCFLAGS) $(GCIMPORTS) main.go
- $(LD) -o $@ main.$O
package cgosotest
-//void sofunc(void);
+/*
+#cgo LDFLAGS: -L. -lcgosotest
+void sofunc(void);
+*/
import "C"
func Test() {
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build ignore
+
void sofunc(void)
{
extern void goCallback(void);
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// +build ignore
+
package main
-import "cgosotest"
+import "."
func main() {
cgosotest.Test()
# license that can be found in the LICENSE file.
set -e
-gomake out
-LD_LIBRARY_PATH=. ./out
-gomake clean
+gcc -fPIC -g -shared -o libcgosotest.so cgoso_c.c
+go build main.go
+LD_LIBRARY_PATH=. ./main
+rm -f libcgosotest.so main
go test
) || exit $?
-$BROKEN ||
[ "$CGO_ENABLED" != 1 ] ||
[ "$GOHOSTOS" == windows ] ||
[ "$GOHOSTOS" == darwin ] ||
(xcd ../misc/cgo/testso
-"$GOMAKE" clean
./test.bash
) || exit $?