This is an experimental/exploratory project to assess the feasibility of compiling Go projects into portable C11.
- Support the full Go standard library, including generics and reflection
(with the exception of
runtime/*andsyscallpackage functionality). - Each source
.gofile is compiled into a corresponding.cfile and each package is compiled into a pair of private + public.hfiles. - A simple
<go.h>header suitable for customizing the Go 'runtime' and the underlying implementation of builtin types. - Enable Go code to seamlessly interoperate with cutting-edge C projects, such as Cosmopolitan Libc for cross-OS binary portability and Fil-C for securing unsafe/cgo and protecting runtime data-structures from corruption by goroutine data-races.
- cgo without the overhead, this may eventually become a more suitable compiler for use in graphics.gd.
The project is in a very early stage, and only supports compiling a small subset of Go programs that don't use the standard library. In order to avoid memory leaks, the output should be linked with a conservative garbage collector (for example, The Boehm-Demers-Weiser Garbage Collector) or built with a C11 compiler that includes a garbage collector (see. Fil-C).
- Compiler: AGPL-3.0 (the .go code in this repo)
- Runtimes: MIT (all .c and .h code in this repo)