github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/testdata/cgo/extra.go (about) 1 package main 2 3 // Make sure CGo supports multiple files. 4 5 // #include "test.h" 6 // int fortytwo(void); 7 // static float headerfunc_static(float a) { return a - 1; } 8 // static void headerfunc_void(int a, int *ptr) { *ptr = a; } 9 import "C" 10 11 func headerfunc_2() { 12 // Call headerfunc_static that is different from the headerfunc_static in 13 // the main.go file. 14 // The upstream CGo implementation does not handle this case correctly. 15 println("static headerfunc 2:", C.headerfunc_static(5)) 16 17 // Test function without return value. 18 var n C.int 19 C.headerfunc_void(3, &n) 20 println("static headerfunc void:", n) 21 22 // anonymous structs and enums in multiple Go files 23 var _ C.teststruct 24 var _ C.testenum 25 }