initial support for cgo
I'm sure that the added test case doesn't cover many edge cases, but it's a start. Fixes #12.pull/22/head
parent
5aaa086e5d
commit
04dea79b2d
@ -0,0 +1,30 @@
|
|||||||
|
garble build
|
||||||
|
exec ./main
|
||||||
|
cmp stdout main.stdout
|
||||||
|
binsubstr main$exe 'privateAdd'
|
||||||
|
|
||||||
|
[short] stop # no need to verify this with -short
|
||||||
|
|
||||||
|
go build
|
||||||
|
exec ./main
|
||||||
|
cmp stdout main.stdout
|
||||||
|
|
||||||
|
-- go.mod --
|
||||||
|
module foo.com/main
|
||||||
|
-- main.go --
|
||||||
|
package main
|
||||||
|
|
||||||
|
/*
|
||||||
|
static int privateAdd(int a, int b) {
|
||||||
|
return a + b;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Println(C.privateAdd(C.int(1), C.int(2)))
|
||||||
|
}
|
||||||
|
-- main.stdout --
|
||||||
|
3
|
Loading…
Reference in New Issue