XenoAtom.Interop ๐
March 18, 2025 ยท View on GitHub
This XenoAtom.Interop project provides a set of C# libraries to interop with C/C++ libraries.
โจ Features
- API generated automatically from C/C++ headers providing a near 100% API coverage.
- Low-level interop with C/C++ libraries
- The C/C++ API exposed is raw and will use pointers...etc.
- Pure Function Pointers generated for callbacks, no managed delegates.
- Similarly for
ReadOnlySpan<byte>whenever possible.
- Modern interop using
[LibraryImport]with P/Invoke source generation.- Some functions taking or returning strings try to offer a more user-friendly API by using
string(but the raw function is still accessible!) - Fast UTF16 to UTF8 string marshalling with zero allocations (for small strings).
DllImportResolversupport for each library to customize loading the native library.
- Some functions taking or returning strings try to offer a more user-friendly API by using
- No native binaries are provided, only the P/Invoke bindings.
- But some 3rd party NuGet packages might provide compatible native libraries. See the list of available compatible packages in each library below.
- Simple API XML documentation is provided for each library whenever possible (extracted from the C/C++ headers).
- NativeAOT Compatible.
- Supports
net8.0+
๐ฆ Libraries
The C/C++ header files from the Alpine Linux v3.21 were used to generated automatically the .NET P/Invoke bindings.
The following libraries are available:
| Library | Native Version | Arch | NuGet |
|---|---|---|---|
| XenoAtom.Interop This package provides the shared types FixedArray#<T> to interop between .NET and C/C++. | - | all | |
| XenoAtom.Interop.musl musl libc is an implementation of the C standard library providing access to the Linux kernel syscalls. | musl1.2.5 | linux-x64, linux-arm64 | |
| XenoAtom.Interop.libgit2 libgit2 is a pure C implementation of the git core methods. | libgit21.8.4 | all | |
| XenoAtom.Interop.sqlite SQLite is a small and fast SQL database engine. | sqlite3.48.0 | all | |
| XenoAtom.Interop.zlib zlib compression library. | zlib1.3.1 | all | |
| XenoAtom.Interop.vulkan Vulkan is a low-overhead, cross-platform 3D graphics and compute API. | vulkan1.3.296.0 | all | |
| XenoAtom.Interop.libdrm libdrm is a userspace library that provides a user-space API to the Direct Rendering Manager. | libdrm2.4.123 | linux | |
| XenoAtom.Interop.libgbm libgbm is a userspace library that provides an abstraction for buffer management used by graphics drivers. | libgbm24.2.8 | linux | |
| XenoAtom.Interop.libshaderc libshaderc is a library for compiling GLSL/HLSL to SPIR-V. | libshaderc2024.0 | all | |
| XenoAtom.Interop.libkmod libkmod is a library for managing kernel modules. | libkmod33 | linux |
all: The library is available for all supported architectures.- For
musllibrary, it will work ifmuslis installed on the system. Typically on Alpine Linux you don't need to install anything. So the targetslinux-musl-x64andlinux-musl-arm64are supported by default.
๐ User Guide
Coming soon! ๐ค
๐ชช License
This software is released under the BSD-2-Clause license.
๐ค Author
Alexandre Mutel aka xoofx.