1

add cgo example; fix zig url

This commit is contained in:
Motiejus Jakštys 2021-06-07 22:33:34 +03:00 committed by Motiejus Jakštys
parent 5daa23e987
commit 5860621c80
4 changed files with 19 additions and 1 deletions

7
BUILD
View File

@ -0,0 +1,7 @@
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
# gazelle:build_file_name BUILD
gazelle(name = "gazelle")
buildifier(name = "buildifier")

View File

@ -11,3 +11,5 @@ cc_binary(
name = "exception", name = "exception",
srcs = ["exception.cpp"], srcs = ["exception.cpp"],
) )
# go build -ldflags "-linkmode external -extldflags -static" hello.go

9
test/hello.go Normal file
View File

@ -0,0 +1,9 @@
package main
// #include <stdio.h>
// void helloworld() { printf("hello, world\n"); }
import "C"
func main() {
C.helloworld()
}

View File

@ -82,7 +82,7 @@ def toolchain_repositories():
name = "com_github_ziglang_zig", name = "com_github_ziglang_zig",
version = "0.8.0", version = "0.8.0",
url_format = "https://ziglang.org/builds/zig-{host_platform}-{version}.tar.xz", url_format = "https://ziglang.org/download/{version}/zig-{host_platform}-{version}.tar.xz",
host_platform_sha256 = { host_platform_sha256 = {
"linux-x86_64": "502625d3da3ae595c5f44a809a87714320b7a40e6dff4a895b5fa7df3391d01e", "linux-x86_64": "502625d3da3ae595c5f44a809a87714320b7a40e6dff4a895b5fa7df3391d01e",
"macos-x86_64": "279f9360b5cb23103f0395dc4d3d0d30626e699b1b4be55e98fd985b62bc6fbe", "macos-x86_64": "279f9360b5cb23103f0395dc4d3d0d30626e699b1b4be55e98fd985b62bc6fbe",