🌐
Go
go.dev › wiki › cgo
Go Wiki: cgo - The Go Programming Language
First, https://pkg.go.dev/cmd/cgo is the primary cgo documentation.
🌐
Go Packages
pkg.go.dev › cmd › cgo
cgo command - cmd/cgo - Go Packages
April 7, 2026 - For security reasons, only a limited set of flags are allowed, notably -D, -U, -I, and -l. To allow additional flags, set CGO_CFLAGS_ALLOW to a regular expression matching the new flags. To disallow flags that would otherwise be allowed, set CGO_CFLAGS_DISALLOW to a regular expression matching arguments that must be disallowed.
🌐
Go
go.dev › blog › cgo
C? Go? Cgo! - The Go Programming Language
The cgo command documentation has more detail about the C pseudo-package and the build process.
🌐
Zchee
zchee.github.io › golang-wiki › cgo
cgo - Go Programming Language Wiki
First, https://pkg.go.dev/cmd/cgo is the primary cgo documentation.
🌐
7-Zip Documentation
documentation.help › Golang › cgo.html
cgo - go-wiki - Tips for interfacing with C code and libraries using cgo. - Go Language Community Wiki - Google Project Hosting - Golang Documentation
First, http://golang.org/cmd/cgo is the primary cgo documentation · There is also a good intrduction article at http://golang.org/doc/articles/c_go_cgo.html
🌐
GitHub
github.com › golang › go › wiki › cgo
cgo · golang/go Wiki
Try https://go.dev/wiki/cgo or https://go.dev/wiki/.
Author   golang
🌐
Keep It Simple
dingyuqi.com › en › article › cgo
Cgo Call Practice | Blog | Keep It Simple
February 14, 2026 - Cgo calls are mainly divided into two types: Put C language code into the Go language file in the form of comments. Provide C language code to the Go source code in the form of ...
🌐
Google
golang.google.cn › pkg › runtime › cgo
Package cgo - The Go Programming Language
Package cgo contains runtime support for code generated by the cgo tool. See the documentation for the cgo command for details on using cgo.
🌐
Palo Alto Networks
docs-cortex.paloaltonetworks.com › r › Cortex-XSIAM › Cortex-XSIAM-Documentation › Causality-Group-Owner-CGO
Causality Group Owner (CGO) - Cortex XSIAM - Cortex
December 29, 2025 - Loading application · Your web browser must have JavaScript enabled in order for this application to display correctly
Find elsewhere
🌐
Golang
golang.bg › pkg › runtime › cgo
cgo - Packages - Go Documentation Server
package main /* #include <stdint.h> // for uintptr_t extern void MyGoPrint(uintptr_t handle); void myprint(uintptr_t handle); */ import "C" import "runtime/cgo" //export MyGoPrint func MyGoPrint(handle C.uintptr_t) { h := cgo.Handle(handle) val := h.Value().(string) println(val) h.Delete() } func main() { val := "hello Go" C.myprint(C.uintptr_t(cgo.NewHandle(val))) // Output: hello Go }
🌐
DEV Community
dev.to › metal3d › understand-how-to-use-c-libraries-in-go-with-cgo-3dbn
Understand how to use C libraries in Go, with CGO - DEV Community
October 9, 2023 - Now that we have seen how CGO can compile C code, let's try to tell it to link shared libraries. For the example, I will use the very simple "libuuid". You need to install the devel package of the library to get the header files. On Fedora, that was a simple sudo dnf install libuuid-devel command line. To be able to generate a UUID, you need to read the documentation of the library (yes...
🌐
Go
go.dev › src › cmd › cgo › doc.go
- The Go Programming Language
589 590 Cgo reads a set of Go source files and looks for statements saying 591 import "C". If the import has a doc comment, that comment is 592 taken as literal C code to be used as a preamble to any C code 593 generated by cgo. A typical preamble #includes necessary definitions: 594 595 // #include <stdio.h> 596 import "C" 597 598 For more details about the usage of cgo, see the documentation 599 comment at the top of this file.
🌐
Go
go.googlesource.com › go › + › master › src › cmd › cgo › doc.go
src/cmd/cgo/doc.go - go - Git at Google
Sign in · go/go/master/./src/cmd/cgo/doc.go · blob: 47d243d1a16190b5205dde6aad8ea521cbabe8ad [file] · Powered by Gitiles| Privacy| Termstxt json
🌐
GitHub
github.com › golang › go › blob › master › src › runtime › cgo › cgo.go
go/src/runtime/cgo/cgo.go at master · golang/go
by the cgo tool. See the documentation for the cgo command · for details on using cgo. */ package cgo · · /* · #cgo darwin,!arm64 LDFLAGS: -lpthread · #cgo darwin,arm64 LDFLAGS: -framework CoreFoundation · #cgo dragonfly LDFLAGS: -lpthread · #cgo freebsd LDFLAGS: -lpthread ·
Author   golang
🌐
Rust
docs.rs › cgo
cgo - Rust
A library for build scripts to compile custom Go code, inspired by the excellent cc crate.
🌐
Matrix
matrix-org.github.io › go-neb › pkg › C › index.html
cgo - The Go Programming Language
All the cgo CPPFLAGS and CFLAGS directives in a package are concatenated and used to compile C files in that package. All the CPPFLAGS and CXXFLAGS directives in a package are concatenated and used to compile C++ files in that package. All the LDFLAGS directives in any package in the program ...
🌐
Lobaro
lobaro.com › en › embedded-development-with-c-and-golang-cgo
Embedded development with C and GoLang (CGO) - Lobaro.com
We already did some type conversion between int and C.int. The same works for all other types. If you have a struct my_struct_t in C you can just use is with C.my_struct_t in Go. You can access all fields of the C structs and the CGO compiler will even check the types and detect when you access non existing fields.
🌐
Go
go.dev › src › runtime › cgo › cgo.go
cgo.go
9 */ 10 package cgo 11 12 /* 13 14 #cgo darwin,!arm64 LDFLAGS: -lpthread 15 #cgo darwin,arm64 LDFLAGS: -framework CoreFoundation 16 #cgo dragonfly LDFLAGS: -lpthread 17 #cgo freebsd LDFLAGS: -lpthread 18 #cgo android LDFLAGS: -llog 19 #cgo !android,linux LDFLAGS: -lpthread 20 #cgo netbsd LDFLAGS: -lpthread 21 #cgo openbsd LDFLAGS: -lpthread 22 #cgo aix LDFLAGS: -Wl,-berok 23 #cgo solaris LDFLAGS: -lxnet 24 #cgo solaris LDFLAGS: -lsocket 25 26 // Use -fno-stack-protector to avoid problems locating the 27 // proper support functions.