How is ClangSharp compared to CppSharp? #482
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
They are different projects with different goals. ClangSharp's goal is to create 1-to-1 blittable bindings (such that they work with There then exists some support for also processing a subset of Even the ClangSharp AST provided is essentially as 1-to-1 as you can get over the corresponding Clang C++ API surface area. CppSharp on the other hand is not so 1-to-1 and takes various creative liberties. It also aims explicitly to support advanced C++ concepts that do not have a clean translation to C# or necessarily a stable cross platform ABI. These differences don't necessarily make one project better or worse than the other. They are intended for different use cases with some amount of overlap due to having similar high level goals around generating interop bindings for C/C++ code. Each project is well established, has been used by other major projects with success, and can ultimately achieve similar end goals. So which you use ultimately comes down to preference, target scenario, and whether any limitations that one or the other have is impactful to what you're wanting to support. |
Beta Was this translation helpful? Give feedback.
They are different projects with different goals.
ClangSharp's goal is to create 1-to-1 blittable bindings (such that they work with
[assembly: DisableRuntimeMarshalling]
), primarily over C code and supports a limited subset of C++ (such as Windows COM) where a stable ABI is possible.There then exists some support for also processing a subset of
#define
macros that are declaring constant like data and for handling inline functions that use portable expressions/statements.Even the ClangSharp AST provided is essentially as 1-to-1 as you can get over the corresponding Clang C++ API surface area.
CppSharp on the other hand is not so 1-to-1 and takes various creative liberties. It also aims…