I’m interested in writing bindings to a 3rd-party C API. I’ve looked over the C Bindings, though I was wondering if there’s an end-to-end project example somewhere? Something which illustrates code and file structure, conventions, etc. I’m not sure where to begin, and a full/complete example would be helpful.
libllvm, libcrypto, libssl from the std-lib are some examples.
Using crystal-lang/crystal_lib might be helpful. But if you are not fully aware of all the C api it might be better to start small. That is the approach I use for example in https://github.com/bcardiff/crystal-z3 to play a bit with the object model of the API.
libfoo.cr will have the
@[Link] and raw types. A
foo.cr will require it and define some API and names in a more crystal way.