github.com/mdempsky/go@v0.0.0-20151201204031-5dd372bd1e70/misc/cgo/test/issue1328.go (about)

     1  // Copyright 2011 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  import "testing"
     8  
     9  // extern void BackIntoGo(void);
    10  // void IntoC(void);
    11  import "C"
    12  
    13  //export BackIntoGo
    14  func BackIntoGo() {
    15  	x := 1
    16  
    17  	for i := 0; i < 10000; i++ {
    18  		xvariadic(x)
    19  		if x != 1 {
    20  			panic("x is not 1?")
    21  		}
    22  	}
    23  }
    24  
    25  func xvariadic(x ...interface{}) {
    26  }
    27  
    28  func test1328(t *testing.T) {
    29  	C.IntoC()
    30  }