Automatic C-Go Bindings Generator for Go Programming Language
See the codeAutomatic C-Go Bindings Generator for Go Programming Language
This project allows to reuse existing C/C++ libraries in your Go applications, by automatically creating c-go bindings for a given set of C headers and the manifest file. We believe in component-based software engineering and think that reusing C/C++ code in Go applications could bring a huge boost to developer's productivity and system's performance. Read more about the motivation: top reasons to use bindings.
The only component required to produce a Go package that will wrap the source C/C++ code is the YAML manifest file that defines parsing, translation and generation rules. The manifest can have just a few lines, however in order to match Go's naming conventions and provide enough tips for type conversions it usually contains about 100 lines, which is still better than producing tens of thousands lines of Go code by hand.
The resulting bindings are as low-level as C code, i.e. it would require knowledge of memory management to carefully use the resulting code, however no more C code is needed to make things done. Eventually some functions can be replaced manually with pure-Go analogs. Also usually a high-level wrapper is created by hand, to introduce Object Oriented Design into API, manage inner state and memory, thus making things safe and lifting the mental overhead.
Full documentation is available at https://github.com/xlab/c-for-go/wiki
$ go install github.com/xlab/c-for-go@latest
A simple Makefile template.
MIT
Overall
Maintained
Code review
Go module
Latest release
Releases this year
(top 24 of 31)
13,895 followers · starred Sep 2016
356 followers · starred Oct 2016
2,743 followers · starred Jan 2017
802 followers · starred Sep 2016
Automatic C-Go Bindings Generator for Go Programming Language
See the codeAutomatic C-Go Bindings Generator for Go Programming Language
This project allows to reuse existing C/C++ libraries in your Go applications, by automatically creating c-go bindings for a given set of C headers and the manifest file. We believe in component-based software engineering and think that reusing C/C++ code in Go applications could bring a huge boost to developer's productivity and system's performance. Read more about the motivation: top reasons to use bindings.
The only component required to produce a Go package that will wrap the source C/C++ code is the YAML manifest file that defines parsing, translation and generation rules. The manifest can have just a few lines, however in order to match Go's naming conventions and provide enough tips for type conversions it usually contains about 100 lines, which is still better than producing tens of thousands lines of Go code by hand.
The resulting bindings are as low-level as C code, i.e. it would require knowledge of memory management to carefully use the resulting code, however no more C code is needed to make things done. Eventually some functions can be replaced manually with pure-Go analogs. Also usually a high-level wrapper is created by hand, to introduce Object Oriented Design into API, manage inner state and memory, thus making things safe and lifting the mental overhead.
Full documentation is available at https://github.com/xlab/c-for-go/wiki
$ go install github.com/xlab/c-for-go@latest
A simple Makefile template.
MIT
Overall
Maintained
Code review
Go module
Latest release
Releases this year
(top 24 of 31)
13,895 followers · starred Sep 2016
356 followers · starred Oct 2016
2,743 followers · starred Jan 2017
802 followers · starred Sep 2016