Skip to content
Maxim edited this page May 16, 2019 · 9 revisions

Project documentation

Navigate menu on the right to jump through sections.

What is c-for-go?

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 c-for-go 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 bindings.

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 c-for-go 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.

Enterprise users

The project is free to use, free to distribute and free to fork as in MIT license. However, for enterprise users we can provide additional services and help you to compose the manifest, consult about the best workflows with C-Go bindings, verify and improve the resulting Go packages. For enquiries please contact me :).

Share this link among your colleagues: https://c.for-go.com

License

The MIT License (MIT)
Copyright © 2015-2019 Maxim Kupriianov <max@kc.vc>

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.