github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/misc/cgo/test/callback_c.c (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 #include <sys/types.h> 6 #include "_cgo_export.h" 7 8 void 9 callback(void *f) 10 { 11 // use some stack space 12 volatile char data[64*1024]; 13 14 data[0] = 0; 15 goCallback(f); 16 data[sizeof(data)-1] = 0; 17 } 18 19 void 20 callGoFoo(void) 21 { 22 extern void goFoo(void); 23 goFoo(); 24 } 25 26 void 27 IntoC(void) 28 { 29 BackIntoGo(); 30 } 31 32 void 33 twoSleep(int n) 34 { 35 BackgroundSleep(n); 36 sleep(n); 37 }