mirror of https://github.com/tinygo-org/tinygo.git
wasmstm32webassemblymicrocontrollerarmavrspiwasiadafruitarduinocircuitplayground-expressgpioi2cllvmmicrobitnrf51nrf52nrf52840samd21tinygo
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
698 B
25 lines
698 B
package main
|
|
|
|
// Make sure CGo supports multiple files.
|
|
|
|
// #include "test.h"
|
|
// int fortytwo(void);
|
|
// static float headerfunc_static(float a) { return a - 1; }
|
|
// static void headerfunc_void(int a, int *ptr) { *ptr = a; }
|
|
import "C"
|
|
|
|
func headerfunc_2() {
|
|
// Call headerfunc_static that is different from the headerfunc_static in
|
|
// the main.go file.
|
|
// The upstream CGo implementation does not handle this case correctly.
|
|
println("static headerfunc 2:", C.headerfunc_static(5))
|
|
|
|
// Test function without return value.
|
|
var n C.int
|
|
C.headerfunc_void(3, &n)
|
|
println("static headerfunc void:", n)
|
|
|
|
// anonymous structs and enums in multiple Go files
|
|
var _ C.teststruct
|
|
var _ C.testenum
|
|
}
|
|
|