cgo

Crates.iocgo
lib.rscgo
version0.4.0
created_at2023-06-06 05:04:40.492361+00
updated_at2025-08-07 13:41:31.547232+00
descriptionA library for build scripts to compile custom Go code
homepage
repositoryhttps://github.com/ryanfowler/cgo-rs
max_upload_size
id883529
size19,614
Ryan Fowler (ryanfowler)

documentation

https://docs.rs/cgo

README

cgo-rs

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 = "*"

Examples

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");
}
Commit count: 29

cargo fmt