mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 23:13:40 +00:00
cgo: implement support for static functions
This commit is contained in:
committed by
Ron Evans
parent
91104b2f27
commit
5551ec7a1e
Vendored
+3
@@ -12,6 +12,7 @@ int mul(int, int);
|
||||
import "C"
|
||||
|
||||
// int headerfunc(int a) { return a + 1; }
|
||||
// static int headerfunc_static(int a) { return a - 1; }
|
||||
import "C"
|
||||
|
||||
import "unsafe"
|
||||
@@ -47,6 +48,8 @@ func main() {
|
||||
|
||||
// functions in the header C snippet
|
||||
println("headerfunc:", C.headerfunc(5))
|
||||
println("static headerfunc:", C.headerfunc_static(5))
|
||||
headerfunc_2()
|
||||
|
||||
// equivalent types
|
||||
var goInt8 int8 = 5
|
||||
|
||||
Reference in New Issue
Block a user