split go and c examples
This commit is contained in:
16
test/go/BUILD
Normal file
16
test/go/BUILD
Normal file
@@ -0,0 +1,16 @@
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
||||
|
||||
# go build -ldflags "-linkmode external -extldflags -static" hello.go
|
||||
go_library(
|
||||
name = "go_lib",
|
||||
srcs = ["hello.go"],
|
||||
cgo = True,
|
||||
importpath = "github.com/motiejus/bazel-zig-cc/test/go",
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name = "go",
|
||||
embed = [":go_lib"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
9
test/go/hello.go
Normal file
9
test/go/hello.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package main
|
||||
|
||||
// #include <stdio.h>
|
||||
// void helloworld() { printf("hello, world\n"); }
|
||||
import "C"
|
||||
|
||||
func main() {
|
||||
C.helloworld()
|
||||
}
|
||||
Reference in New Issue
Block a user