github.com/hbdrawn/golang@v0.0.0-20141214014649-6b835209aba2/misc/cgo/testso/test.bash (about) 1 #!/usr/bin/env bash 2 # Copyright 2011 The Go Authors. All rights reserved. 3 # Use of this source code is governed by a BSD-style 4 # license that can be found in the LICENSE file. 5 6 set -e 7 8 args= 9 dyld_envvar=LD_LIBRARY_PATH 10 ext=so 11 if [ "$(uname)" == "Darwin" ]; then 12 args="-undefined suppress -flat_namespace" 13 dyld_envvar=DYLD_LIBRARY_PATH 14 ext=dylib 15 fi 16 17 dylib=libcgosotest.$ext 18 $(go env CC) $(go env GOGCCFLAGS) -shared $args -o $dylib cgoso_c.c 19 go build main.go 20 21 eval "$dyld_envvar"=. ./main 22 rm -rf $dylib main *.dSYM