示例#1
0
func main() {
	var a, b int = 1, 2
	r := C.sum(C.int(a), C.int(b)) // C 언어 함수 sum 호출
	fmt.Println(r)                 // 3

	C.hello() // Hello, world!
}
示例#2
0
文件: rand.go 项目: kangaukju/golang
func main() {
	r := C.rand()
	fmt.Println(r)

	var a, b int = 10, 20
	r = C.sum(C.int(a), C.int(b))
	fmt.Println(r)

	r = C.sum(C.int(20), C.int(30))
	fmt.Println(r)

	C.hello()
}
示例#3
0
func main() {

	Seed(1000)

	fmt.Println(int(C.random()))
	time.Sleep(time.Duration(1) * time.Second)
	fmt.Println(int(C.random()))

	fmt.Println("getpid:", int(C.getpid()))
	C.puts(C.CString("call C puts"))

	Hello("call C's go wrapper func")
	C.hello(C.CString("call C hello func"))
}
示例#4
0
func Hello(s string) {
	cs := C.CString(s)
	C.hello(cs)
}
示例#5
0
func main() {
	C.hello()
}
示例#6
0
文件: testc.go 项目: jackyfan/gostudy
func Hello() {
	C.hello()
}
示例#7
0
func main() {
	C.hello(C.CString("John Smith"))
}
示例#8
0
func Hello() int {
	return int(C.hello())
}