purebind
purebind is a CLI tool that parses C-style header files and generates pure Go function bindings using purego.
see generated example
Features
- Parses
.h header files
- Generates Go bindings using purego
Installation
go install github.com/sunaipa5/purebind@latest
Usage
purebind <project-name> <header-file-path>
Example:
purebind mylib ./mylib.h
This will generate:
mylib/
├── wrapper.go
├── lib.go
└── go.mod
Example
Given a C header file:
int add(int a, int b);
void print_message(const char *msg);
The generated Go code will look like:
var (
add func(int32, int32) int32
print_message func(unsafe.Pointer)
)