all: add bare-bones Cgo support

This commit is contained in:
Ayke van Laethem
2018-11-29 13:31:16 +01:00
parent b99bbc880a
commit ecf6ffa62e
11 changed files with 408 additions and 9 deletions
+9
View File
@@ -0,0 +1,9 @@
#include <stdint.h>
int32_t fortytwo() {
return 42;
}
int32_t mul(int32_t a, int32_t b) {
return a * b;
}
+13
View File
@@ -0,0 +1,13 @@
package main
/*
#include <stdint.h>
int32_t fortytwo(void);
int32_t mul(int32_t a, int32_t b);
*/
import "C"
func main() {
println("fortytwo:", C.fortytwo())
println("mul:", C.mul(int32(3), 5))
}
+2
View File
@@ -0,0 +1,2 @@
fortytwo: 42
mul: 15