Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

headers

v1.82.14
modernc.org/libc/headers

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

2 matches

Top ↑

Package headers provides the C system headers of modernc.org/libc for the target it is built for, for C compilers that run without host files.

The headers are musl's public include tree, configured for the target, as libc's generator writes it to include/<goos>/<goarch> in this module. These are the files ccgo/v4 uses by default when it translates C against libc. They describe libc's ABI as ccgo sees it, so a compiler must use them the way ccgo does. It must predefine __CCGO__, which makes long double a double, as libc implements it, and the predefined macros of the target. ccgo also defines _GNU_SOURCE.

Each target's headers are embedded as a ZIP archive, so a binary carries only its own target's headers, and only if it calls FS. Importing the package costs nothing otherwise. Only linux/amd64 has headers so far; on other targets FS fails.

musl is distributed under the MIT license. Its copyright notice is the file COPYRIGHT in the root of the tree FS returns.

Functions

FS

func FS() (fs.FS, error)

FS returns the include tree of the target: FS().Open("stdio.h") opens what #include <stdio.h> includes. Each call returns a new *zip.Reader, which may be used concurrently.

No package-level initializer may refer to archive, otherwise the linker would keep it in every binary importing the package.

Dependency graph