github.com/huandu/go@v0.0.0-20151114150818-04e615e41150/misc/cgo/test/issue5548_c.c (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  #include "_cgo_export.h"
     6  
     7  static void clobber_stack() {
     8  	volatile char a[1024];
     9  	int i;
    10  	for(i = 0; i < sizeof a; i++)
    11  		a[i] = 0xff;
    12  }
    13  
    14  static int call_go() {
    15  	GoString s;
    16  	s.p = "test";
    17  	s.n = 4;
    18  	return issue5548FromC(s, 42);
    19  }
    20  
    21  int issue5548_in_c() {
    22  	clobber_stack();
    23  	return call_go();
    24  }