2 ms·
Hare uses a superset of the C ABI and interop with C should be relatively straightforward. You can see an example with SDL2 here: https://git.sr.ht/~sircmpwn/h
by ddevault 4y ago
Hare uses a superset of the C ABI and interop with C should be relatively straightforward. You can see an example with SDL2 here:
https://git.sr.ht/~sircmpwn/hare-examples/tree/master/item/sdl2.ha https://git.sr.ht/~sircmpwn/hare-examples/tree/master/item/s...
We have some planned improvements which will make this easier still. We'd like to improve the build driver's ability to link with C libraries via pkg-config, and automatically rig it up when you depend on C interop modules like hare-sdl2. Code generation to automatically provide bindings going either direction is also something we'd like to work on.
Zig goes, imho, a little bit too far. Hare has no intention of providing a built-in C toolchain, and does not treat C as more special than any other language for interop. It's a question of scope.