github.com/huandu/go@v0.0.0-20151114150818-04e615e41150/misc/cgo/test/issue5227.go (about) 1 // Copyright 2013 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 // Issue 5227: linker incorrectly treats common symbols and 6 // leaves them undefined. 7 8 package cgotest 9 10 /* 11 typedef struct { 12 int Count; 13 } Fontinfo; 14 15 Fontinfo SansTypeface; 16 17 extern void init(); 18 19 Fontinfo loadfont() { 20 Fontinfo f = {0}; 21 return f; 22 } 23 24 void init() { 25 SansTypeface = loadfont(); 26 } 27 */ 28 import "C" 29 30 import "testing" 31 32 func test5227(t *testing.T) { 33 C.init() 34 } 35 36 func selectfont() C.Fontinfo { 37 return C.SansTypeface 38 }