Fork me on GitHub

ClangSharp - C# and .NET Clang bindings

ClangSharp are strongly-typed safe C# bindings for LibClang C bindings from the Clang project. ClangSharp is self hosting and generates itself from Libclang header files.

ClangSharp generated interfaces are one single C# file -- Example: ClangSharp Source

Windows users (includes LibClang x86/x64 DLLs): ClangSharp 3.6 on Nuget

Also checkout LLVMSharp - LLVM Bindings for C# (generated using ClangSharp PInvoke Generator)

Building ClangSharp

ClangSharp runs (and hence requires) either Mono or Microsoft .NET; and at least Clang to be built as a shared library (this is default on Linux and Windows).

These instructions assume you are familiar with building LLVM and/or building Clang as Shared Libraries.


Using Mono (on Linux, MacOSX):
$ git clone
$ cd ClangSharp
$ chmod +x
$ ./ /path/to/ /path/clang/include


Using Microsoft.NET (on Windows):
:> git clone
:> cd ClangSharp
:> build.bat c:\path\libclang.dll c:\path\to\clang\include

ClangSharp PInvoke Generator

ClangSharp PInvoke Generator is ClangSharp's self-hosting mechanism that generates ClangSharp using ClangSharp. It is also a great example of using ClangSharp (to generate C# PInvoke interfaces).


Copyright (C) 2015 Mukul Sabharwal (@mjsabby)
Distributed under the University of Illinois/NCSA Open Source License, the same as Clang and LLVM.