Crates.io | cgo_oligami |
lib.rs | cgo_oligami |
version | 0.3.6 |
source | src |
created_at | 2023-09-17 12:12:05.438048 |
updated_at | 2023-11-09 06:22:10.269696 |
description | A library for build scripts to compile custom Go code |
homepage | |
repository | https://github.com/oligami-0424/cgo-rs |
max_upload_size | |
id | 975058 |
size | 20,766 |
A library for build scripts to compile custom Go code, inspired by the excellent cc crate.
It is intended that you use this library from within your build.rs
file by
adding the cgo crate to your build-dependencies
:
[build-dependencies]
cgo_oligami = "*"
The following example will statically compile the Go package and instruct
cargo to link the resulting library (libexample
).
fn main() {
cgo::Build::new()
.package("pkg/example/main.go")
.build("example");
}
Golang is not support llvm on windows so Rust cannot link Golang staticlib on windows https://github.com/golang/go/issues/17014 If you use, dynamiclib https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute
mac and linux without alpine
https://zenn.dev/koya_iwamura/articles/bb9b590b57d825 https://tip.golang.org/doc/go1.21#go-command