ccgo

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: BSD-3-Clause, BSD-3-Clause Imports: 29 Imported by: 3

README

ccgo/v2

Package ccgo translates c99 ASTs to Go. Work In Progress. API unstable.

The v1 and v2 versions are no longer maintained. Please see the v3 version at

https://modernc.org/ccgo/v3
Installation

To install or update ccgo and its accompanying tools

 $ go get [-u] modernc.org/ccgo/v2/...

Documentation: godoc.org/modernc.org/ccgo/v2

Building with make requires the following Go packages

  • github.com/golang/lint/golint
  • github.com/mdempsky/maligned
  • github.com/mdempsky/unconvert
  • honnef.co/go/tools/cmd/unused
  • honnef.co/go/tools/cmd/gosimple
  • github.com/client9/misspell/cmd/misspell

Documentation

Overview

Package ccgo translates C99 ASTs to Go source code. Work In Progress. API unstable.

This package is no longer maintained. Please see the v3 version at

https://modernc.org/ccgo/v3

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewObject

func NewObject(out io.Writer, goos, goarch, file string, in *cc.TranslationUnit, tweaks *NewObjectTweaks) (err error)

NewObject writes a linker object file produced from in that comes from file to out.

func NewSharedObject

func NewSharedObject(out io.Writer, goos, goarch string, in io.Reader) (err error)

NewSharedObject writes shared linker object files from in to out.

Types

type Linker

type Linker struct {
	Main bool // Seen external definition of main.
	// contains filtered or unexported fields
}

Linker produces Go files from object files.

func NewLinker

func NewLinker(out io.Writer, goos, goarch string) (*Linker, error)

NewLinker returns a newly created Linker writing to out.

The Linker must be eventually closed to prevent resource leaks.

func (*Linker) Close

func (l *Linker) Close(header string) (err error)

Close finishes the linking. The header argument is written prior to any other linker's own output, which does not include the package clause.

func (l *Linker) Link(fn string, obj io.Reader) (err error)

Link incerementaly links objects files.

type NewObjectTweaks

type NewObjectTweaks struct {
	DefineValues bool // --ccgo-define-values
	FreeStanding bool // -ffreestanding
	FullTLDPaths bool // --ccgo-full-paths
	StructChecks bool // --ccgo-struct-checks
	Watch        bool // --ccgo-watch
}

NewObjectTweaks amend NewObject behavior.

Directories

Path Synopsis
Command ccgo is a C compiler targeting Go.
Command ccgo is a C compiler targeting Go.
internal
object
Package object reads and writes object files.
Package object reads and writes object files.

Jump to

Keyboard shortcuts

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