Understand the LLVMSharp API design
mainThe LLVMSharp API is auto-generated from LLVM C headers using ClangSharp. It follows these design principles:
- Functionality Parity: It supports all functionality exposed by the LLVM C APIs.
- Type Safety: While many LLVM types are pointers internally, LLVMSharp provides distinct types for them (e.g.,
LLVMValueRefandLLVMTypeRefare different types in C#) to ensure type safety. - API Mapping: The C# API is nearly identical to the LLVM C API, but uses dot notation for method calls. For example, the C function
LLVMModuleCreateWithNamebecomesLLVM.ModuleCreateWithNamein C#.