LLVM from Crystal

I’m trying to use LLVM from Crystal but when I search via google all I can find is info on Crystal’s own use of LLVM. Are there any ways to use LLVM from Crystal? A shard I can install maybe?

EDIT: Or is a C binding the only possiblity?

Check https://crystal-lang.org/api/0.29.0/LLVM.html

It’s not documented at all because we wrote the bindings/wrappers as we wrote the compiler and only for the compiler without expecting others to use it. Plus the API is more or less that of LLVM C API but with a more object-oriented API.

There’s also an example here and LLVM is used in the codegen part of the compiler’s source code.

1 Like