2012-11-29 14 views

回答

1

您可以按照本教程中描述稱用C利布斯:

http://cheesesun.blogspot.de/2009/12/basic-cgo.html

和:

http://siganakis.com/linking-c-libraries-with-go-lang-and-stdc99

,或者你可以看看這個庫:

https://github.com/awsong/MMSEGO

其中文版,但你可以用它來把你自己的算法放在那裏。

+0

的MMSEGO的例子不能運行 – Codefor

+0

什麼樣的手段,不能運行?你有編譯錯誤?或缺少某些東西?也許你還需要去飛鏢:https://github.com/awsong/go-darts –

+1

起源函數太複雜了。我重寫了函數@'https://github.com/codefor/MANDEGO/ blob/darts/mmsego.go' – Codefor

0

使用cgo從Go調用C代碼。

Command cgo

C? Go? Cgo!

+0

包主 /** int MyPrint(){ return 123; } */ 導入 「FMT」 進口 「C」 FUNC主(){ fmt.Println(INT(C.MyPrint())) }提高錯誤#命令行-參數 錯誤:MyPrint '未聲明(首次在此函數中使用) 錯誤:(每個未聲明的標識符只報告一次 – Codefor

+0

@Codefor重新讀取cgo文檔'導入'C''必須直接進行C代碼。 .. – BurntSushi5