c

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 2 Imported by: 138

Documentation

Index

Constants

View Source
const LLGoPackage = "decl"
View Source
const LongDoubleSize = 16

LongDoubleSize is sizeof(long double) in bytes on this target.

Variables

This section is empty.

Functions

func Advance

func Advance[PtrT any, I integer](ptr PtrT, offset I) PtrT

llgo:link Advance llgo.advance

func AllocaNew

func AllocaNew[T any]() *T

TODO(xsw): llgo:link AllocaNew llgo.allocaNew

func Exit

func Exit(Int)

func Fread

func Fread(data Pointer, size, count uintptr, fp FilePtr) uintptr

func Free

func Free(ptr Pointer)

func Fwrite

func Fwrite(data Pointer, size, count uintptr, fp FilePtr) uintptr

func GoClosure added in v0.5.2

func GoClosure[ClosureT any](data Pointer) (closure ClosureT)

func GoString

func GoString(cstr *Char, __llgo_va_list ...any) string

GoString converts a C string to a Go string. TODO(xsw): any => int

func Index

func Index[T any, I integer](ptr *T, offset I) T

llgo:link Index llgo.index

func Perror

func Perror(s *Char)

func Qsort

func Qsort(base Pointer, count, elem uintptr, compar func(a, b Pointer) Int)

func Siglongjmp

func Siglongjmp(jb Pointer, retval Int)

func Strlen

func Strlen(s *Char) uintptr

func Unreachable

func Unreachable()

Types

type Char

type Char = int8
var Argv **Char
var Optarg *Char

func AllocaCStr

func AllocaCStr(s string) *Char

func AllocaCStrs

func AllocaCStrs(strs []string, endWithNil bool) **Char

func GoStringData

func GoStringData(string) *Char

func Str

func Str(string) *Char

func Strcat

func Strcat(dst, src *Char) *Char

func Strchr

func Strchr(s *Char, c Int) *Char

func Strcpy

func Strcpy(dst, src *Char) *Char

func Strdup

func Strdup(s *Char) *Char

func Strerror

func Strerror(errnum Int) *Char

func Strncat

func Strncat(dst, src *Char, n uintptr) *Char

func Strncpy

func Strncpy(dst, src *Char, n uintptr) *Char

func Strndup

func Strndup(s *Char, n uintptr) *Char

func Strrchr

func Strrchr(s *Char, c Int) *Char

func Strstr

func Strstr(s1, s2 *Char) *Char

func Strtok

func Strtok(s, delim *Char) *Char

type Char8T added in v0.5.8

type Char8T = uint8

type Char16T added in v0.5.8

type Char16T = uint16

type Char32T added in v0.5.8

type Char32T = uint32

type DivT added in v0.5.7

type DivT struct {
	Quot Int
	Rem  Int
}

type Double

type Double = float64

type FILE

type FILE struct {
	Unused [0]byte
}

type FilePtr

type FilePtr = *FILE
var Stderr FilePtr
var Stdin FilePtr
var Stdout FilePtr

func Fopen

func Fopen(c *Char, mod *Char) FilePtr

type Float

type Float = float32

type IconvT

type IconvT = Pointer

type Int

type Int = int32
var Argc Int
var Opterr Int
var Optind Int
var Optopt Int

func Atoi

func Atoi(s *Char) Int

func Fclose

func Fclose(fp FilePtr) Int

func Fflush

func Fflush(fp FilePtr) Int

func Fprintf

func Fprintf(fp FilePtr, format *Char, __llgo_va_list ...any) Int

func Fputc

func Fputc(c Int, fp FilePtr) Int

func Fputs

func Fputs(s *Char, fp FilePtr) Int

func Getopt

func Getopt(argc Int, argv **Char, optstring *Char) Int

func GetoptLong

func GetoptLong(argc Int, argv **Char, optstring *Char, longopts *Option, longindex *Int) Int

func GetoptLongOnly

func GetoptLongOnly(argc Int, argv **Char, optstring *Char, longopts *Option, longindex *Int) Int

func Memcmp

func Memcmp(s1, s2 Pointer, n uintptr) Int

func Printf

func Printf(format *Char, __llgo_va_list ...any) Int

func Rand

func Rand() Int

func Sigsetjmp

func Sigsetjmp(jb Pointer, savemask Int) Int

func Snprintf

func Snprintf(s *Char, n uintptr, format *Char, __llgo_va_list ...any) Int

func Sprintf

func Sprintf(s *Char, format *Char, __llgo_va_list ...any) Int

func Strcmp

func Strcmp(s1, s2 *Char) Int

func Strncmp

func Strncmp(s1, s2 *Char, n uintptr) Int

func Usleep

func Usleep(useconds Uint) Int

func Vsnprintf

func Vsnprintf(s *Char, n uintptr, format *Char, ap Pointer) Int

type Int8T

type Int8T = int8

type Int16T

type Int16T = int16

type Int32T

type Int32T = int32

type Int64T

type Int64T = int64

type Int128T added in v0.5.9

type Int128T = types.Int128

type IntmaxT

type IntmaxT = LongLong

type IntptrT

type IntptrT = uintptr

type LdivT added in v0.5.7

type LdivT struct {
	Quot Long
	Rem  Long
}

type LldivT added in v0.5.7

type LldivT struct {
	Quot LongLong
	Rem  LongLong
}

type LocaleT

type LocaleT = Pointer

type Long

type Long = int64

For 64-bit Unix/Linux/macOS, Long is 64-bit

type LongDouble added in v0.5.10

type LongDouble struct {
	Data [16]byte
	// contains filtered or unexported fields
}

LongDouble is the x87 80-bit extended precision format, stored in 16 bytes (10 significant bytes + 6 bytes padding). Applies to x86-64 on Linux/macOS/BSD and MinGW on Windows.

The C ABI requires 16-byte alignment, which Go cannot express (Go caps alignment at 8); the zero-size field below gives 8-byte alignment at most. When embedding LongDouble in a mirrored C struct, add explicit padding so the field offset is a multiple of 16.

type LongLong

type LongLong = int64

type Option

type Option struct {
	Name   *Char
	HasArg Int
	Flag   *Int
	Val    Int
}

type Pointer

type Pointer = unsafe.Pointer

func Alloca

func Alloca(size uintptr) Pointer

func AllocaSigjmpBuf

func AllocaSigjmpBuf() Pointer

func Calloc

func Calloc(num uintptr, size uintptr) Pointer

func ClosureData added in v0.5.2

func ClosureData[ClosureT any](closure ClosureT) Pointer

func Func

func Func(any) Pointer

func GoDeferData

func GoDeferData() Pointer

func Malloc

func Malloc(size uintptr) Pointer

func Memchr

func Memchr(s Pointer, c Int, n uintptr) Pointer

func Memcpy

func Memcpy(dst, src Pointer, n uintptr) Pointer

func Memmove

func Memmove(dst, src Pointer, n uintptr) Pointer

func Memset

func Memset(s Pointer, c Int, n uintptr) Pointer

func Realloc

func Realloc(ptr Pointer, size uintptr) Pointer

type PtrdiffT added in v0.5.6

type PtrdiffT = Long

type SizeT

type SizeT = uintptr

type SsizeT

type SsizeT = Long

type Uint

type Uint = uint32

type Uint8T

type Uint8T = uint8

type Uint16T

type Uint16T = uint16

type Uint32T

type Uint32T = uint32

type Uint64T

type Uint64T = uint64

type Uint128T added in v0.5.9

type Uint128T = types.Uint128

type UintmaxT

type UintmaxT = UlongLong

type UintptrT

type UintptrT = uintptr

type Ulong

type Ulong = uint64

For 64-bit Unix/Linux/macOS, Long is 64-bit

type UlongLong

type UlongLong = uint64

type VaList

type VaList = Pointer

type Void

type Void = [0]byte

type WcharT added in v0.5.9

type WcharT = int32

Directories

Path Synopsis
_test command
Package bitfield provides bit-field access helpers.
Package bitfield provides bit-field access helpers.
_demo/mkjson command
_demo/funcinfo command
ffi
_demo/cfunc command
_demo/closure command
_demo/printf command
_demo/async command
_demo/async_fs command
lua
_demo/coroutine command
_demo/debug command
_demo/dump/load command
_demo/dump/save command
_demo/error command
_demo/hello command
_demo/loadcall command
_demo/metatable command
_demo/stack command
_demo/table command
_demo/thread command
_demo/userdata command
_demo/cgen command
_demo/gen command
_demo/chmacdemo command
_demo/cmd5demo command
_demo/cranddemo command
_demo/cshademo command
os
_demo/readdir command
_demo/tetris command
sync
sys
_demo/crc32demo command
_demo/normal command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL