2016年12月6日 星期二

[Go] 如何和 C 語言做介接

以這個為例 ,quanto2 是我的自定義 C library
這樣就可以call 到 C 的 function



// #cgo LDFLAGS: -L ./ -lquanto2
// #include <stdio.h>
// #include <stdlib.h>
// #include "quanto2.h"
import "C"
import "fmt"

func main() {
    fmt.Println("ho ho")
    C.testGo()
}

沒有留言:

張貼留言