Skip to content
Maxim Kupriianov edited this page Sep 18, 2016 · 9 revisions
cgogen-logo

Project documentation

Navigate menu on the right to jump through sections.

What is cgogen?

This project once had aim to be an assistant tool for creating CGo bindings of C libraries I'd like to use in my apps. The idea was to scan the provided C header files for structs, types and function definitions and convert their names into idiomatic Go ones, preparing boilerplate code for CGo calls, and so on. At some point, I have discovered cznic/cc package and things went crazy, now cgogen is a full-featured bindings generator that does like 95% of the work, it allows anyone who would like to use any C library in their code do so in less than one hour without writing a single line of code.

Read more on how you can benefit from using this tool: top-5 reasons to use cgogen.

Why cznic/cc?

Whereas I like to use C libraries instead of repeating the experience people had for 10 or 20 years on the topic, the resulting portability of cgogen is very important to anyone. So having its codebase done in 100% Go is a pleasure. Also like has been stated in previous section, the project meant to be simple, it's just a fortune that it can handle many generic C libraries now. Keeping this in mind, it seems definitely better to keep all the requirements native (and naive), for instance, I wrote my own pkg-config because of that. And thanks to CC, now we can focus on bindings rather than compiling gigabytes of LLVM toolchain that will heat your room for 2 hours on i5.

Read more about design decisions in this project: design decisions.

For enterprises

The project is free to use, free to distribute and free to fork as in MIT license. However, if you are willing to use the resulting bindings in your business flow and have not enough confidence, or your team is small, or you want a quick result with guarantees, consider a consultation with me. I have a solid background in performant backends and more than 2.5 years of experience running Go in production.

Otherwise just share this link among your colleagues: http://cgogen.com

License

The MIT License (MIT)
Copyright © 2016 Maxim Kupriianov <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.