How-to guides
How-to guides
Recipes for a task, assuming you already know what you want to do.
Each guide answers one question and stops. None of them teaches cppgo from scratch; the tutorial does that.
| You want to | Read | It starts from |
|---|---|---|
| generate a Go package for a C++ library you already build | Generate a binding for your own library | a header and the flags it is compiled with |
| bind a class or function template | Bind a C++ template library | a template header and the Go program that uses it |
| ship the binary with its two C++ files | Ship a program that uses a binding | a generated package that already runs on your machine |
| carry the C++ side inside the Go binary | Embed the C++ side in the Go binary | a program whose source you control |
| know what a failing call returns | Report failures from C++ to Go | a bound call that can fail |
| gate the generated sources in a pipeline | Gate a generated package in CI | a repository that commits them |
When you want the exact surface rather than a task — a flag, a generated signature, an error type — the reference has it.
- Generate a binding for your own library
The command, the compilation configuration, and what a generation error looks like.
- Bind a C++ template library
Generate the Go API for a C++ template, then collect the specializations your program uses, on the metrics example.
- Ship a program that uses a binding
Two C++ files, one directory, and the ways to tell the generated package where they are.
- Embed the C++ side in the Go binary
OpenFS and go:embed: what works today, and what the generated Open does not do yet.
- Report failures from C++ to Go
Exceptions and status codes today; the full projection as designed.
- Gate a generated package in CI
cppgo check, the two test passes, and the toolchain you must pin.