mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
all: add bare-bones Cgo support
This commit is contained in:
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
#include <stdint.h>
|
||||
|
||||
int32_t fortytwo() {
|
||||
return 42;
|
||||
}
|
||||
|
||||
int32_t mul(int32_t a, int32_t b) {
|
||||
return a * b;
|
||||
}
|
||||
Vendored
+13
@@ -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))
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
fortytwo: 42
|
||||
mul: 15
|
||||
Reference in New Issue
Block a user