github.com/huandu/go@v0.0.0-20151114150818-04e615e41150/misc/cgo/test/issue1635.go (about) 1 // Copyright 2012 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package cgotest 6 7 /* 8 // Mac OS X's gcc will generate scattered relocation 2/1 for 9 // this function on Darwin/386, and 8l couldn't handle it. 10 // this example is in issue 1635 11 #include <stdio.h> 12 void scatter() { 13 void *p = scatter; 14 printf("scatter = %p\n", p); 15 } 16 17 // this example is in issue 3253 18 int hola = 0; 19 int testHola() { return hola; } 20 */ 21 import "C" 22 23 import "testing" 24 25 func test1635(t *testing.T) { 26 C.scatter() 27 if v := C.hola; v != 0 { 28 t.Fatalf("C.hola is %d, should be 0", v) 29 } 30 if v := C.testHola(); v != 0 { 31 t.Fatalf("C.testHola() is %d, should be 0", v) 32 } 33 }