1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-24 04:22:22 +00:00

Merge branch 'master' of github.com:chai2010/advanced-go-programming-book

This commit is contained in:
Xargin 2018-01-09 16:18:28 +08:00
commit 4a31483164
2 changed files with 2 additions and 2 deletions

View File

@ -26,7 +26,7 @@ func main() {
mu.Lock() mu.Lock()
}() }()
mu.Unock() mu.Unlock()
} }
``` ```

View File

@ -127,6 +127,6 @@ func SayHello(s *C.char) {
} }
``` ```
虽然看起来全部是Go语言代码但是执行的时候是先从Go语言的`main`函数到CGO自动生成的C语言版本`SayHello`桥接函数,最又回到了Go语言环境的`SayHello`函数。虽然看起来有点绕但CGO确实是这样运行的。 虽然看起来全部是Go语言代码但是执行的时候是先从Go语言的`main`函数到CGO自动生成的C语言版本`SayHello`桥接函数,最又回到了Go语言环境的`SayHello`函数。虽然看起来有点绕但CGO确实是这样运行的。
需要注意的是CGO导出Go语言函数时函数参数中不再支持C语言中`const`修饰符。 需要注意的是CGO导出Go语言函数时函数参数中不再支持C语言中`const`修饰符。