LLVMSharp and ClangSharp - C# .NET/Mono Bindings for LLVM and Clang

LLVMSharp (http://www.llvmsharp.org) and ClangSharp (http://www.clangsharp.org) are type-safe .NET/Mono bindings for LLVM and Clang generated using their respective C header files.

The libraries require LLVM and Clang built as shared libraries, and the C# side Platform Invokes into them.

LLVMSharp is used to demonstrate the Kaleidoscope tutorial in C# (currently Ch3, 4, 5) :


ClangSharpPInvokeGenerator is the mechanism used to generate these bindings and is a demo of LibClang being driven in C#:


I’d also like to take this opportunity to ask if the community would be interested in putting these bindings alongside the C and Python bindings so that build bots and other integration systems can update these bindings automatically as people add C APIs to LLVM or Clang. This would require the build to take a dependency on Mono, as it stands today, but I could easily move the PInvoke generation to use the C API directly.

Also, gladly taking PRs. Some areas needing love: Kaleidoscope chapters (new or improve existing) and generally on improving the robustness of the PInvokeGenerator.