mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 04:22:22 +00:00
example: cgo生成中间文件的例子
This commit is contained in:
parent
a0f2e550f8
commit
fe604df575
9
examples/ch2-05-internal/cgo-gen-files/Makefile
Normal file
9
examples/ch2-05-internal/cgo-gen-files/Makefile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
|
||||||
|
# License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||||
|
|
||||||
|
default: clean
|
||||||
|
# ignore nocgo_*.go files
|
||||||
|
go tool cgo main.go hello.go
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-rm -rf ./_obj
|
6
examples/ch2-05-internal/cgo-gen-files/hello.go
Normal file
6
examples/ch2-05-internal/cgo-gen-files/hello.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
|
||||||
|
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "C"
|
8
examples/ch2-05-internal/cgo-gen-files/main.go
Normal file
8
examples/ch2-05-internal/cgo-gen-files/main.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
|
||||||
|
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
func main() {}
|
4
examples/ch2-05-internal/cgo-gen-files/nocgo_1.go
Normal file
4
examples/ch2-05-internal/cgo-gen-files/nocgo_1.go
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
|
||||||
|
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||||
|
|
||||||
|
package main
|
4
examples/ch2-05-internal/cgo-gen-files/nocgo_x.go
Normal file
4
examples/ch2-05-internal/cgo-gen-files/nocgo_x.go
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// Copyright © 2017 ChaiShushan <chaishushan{AT}gmail.com>.
|
||||||
|
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||||
|
|
||||||
|
package main
|
Loading…
x
Reference in New Issue
Block a user