Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xenoatom/xenoatom.interop

This XenoAtom.Interop project provides a set of C# libraries to interop with C/C++ libraries (musl, libgit2, sqlite, vulkan...)
https://github.com/xenoatom/xenoatom.interop

dotnet libdrm libgbm ligbit2 musl pinvoke pinvoke-wrapper shaderc sqlite vulkan

Last synced: about 2 months ago
JSON representation

This XenoAtom.Interop project provides a set of C# libraries to interop with C/C++ libraries (musl, libgit2, sqlite, vulkan...)

Awesome Lists containing this project

README

        

# XenoAtom.Interop 🚀

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](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-9.0/function-pointers) generated for callbacks, no managed delegates.
- Similarly for `ReadOnlySpan` whenever possible.
- **Modern interop** using [`[LibraryImport]`](https://learn.microsoft.com/en-us/dotnet/standard/native-interop/pinvoke-source-generation) 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).
- [`DllImportResolver`](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.nativelibrary.setdllimportresolver) support for each library to customize loading the native library.
- 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](https://www.alpinelinux.org/) `v3.20` were used to generated automatically the .NET P/Invoke bindings.

The following libraries are available:

| Library | Native Version | Arch | NuGet |
| ------- | -------------- | ---- | ----- |
| [XenoAtom.Interop](src/common)
This package provides the shared types `FixedArray#` to interop between .NET and C/C++. |
`-` | `all` | [![Build Status](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_common.yml/badge.svg)](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_common.yml)
[![NuGet](https://img.shields.io/nuget/v/XenoAtom.Interop.svg)](https://www.nuget.org/packages/XenoAtom.Interop) |
| [XenoAtom.Interop.musl](src/musl)
musl libc is an implementation of the C standard library providing access to the Linux kernel syscalls. | [musl](https://musl.libc.org/)
`1.2.5` | `linux-x64`, `linux-arm64` | [![Build Status](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_musl.yml/badge.svg)](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_musl.yml)
[![NuGet](https://img.shields.io/nuget/v/XenoAtom.Interop.musl.svg)](https://www.nuget.org/packages/XenoAtom.Interop.musl) |
| [XenoAtom.Interop.libgit2](src/libgit2)
libgit2 is a pure C implementation of the git core methods. | [libgit2](https://libgit2.org/)
`1.7.2` | `all` | [![Build Status](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_libgit2.yml/badge.svg)](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_libgit2.yml)
[![NuGet](https://img.shields.io/nuget/v/XenoAtom.Interop.libgit2.svg)](https://www.nuget.org/packages/XenoAtom.Interop.libgit2) |
| [XenoAtom.Interop.sqlite](src/sqlite)
SQLite is a small and fast SQL database engine. | [sqlite](https://www.sqlite.org/)
`3.45.3` | `all` | [![Build Status](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_sqlite.yml/badge.svg)](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_sqlite.yml)
[![NuGet](https://img.shields.io/nuget/v/XenoAtom.Interop.sqlite.svg)](https://www.nuget.org/packages/XenoAtom.Interop.sqlite) |
| [XenoAtom.Interop.zlib](src/zlib)
zlib compression library. | [zlib](https://zlib.net/)
`1.3.1` | `all` | [![Build Status](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_zlib.yml/badge.svg)](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_zlib.yml)
[![NuGet](https://img.shields.io/nuget/v/XenoAtom.Interop.zlib.svg)](https://www.nuget.org/packages/XenoAtom.Interop.zlib) |
| [XenoAtom.Interop.vulkan](src/vulkan)
Vulkan is a low-overhead, cross-platform 3D graphics and compute API. | [vulkan](https://registry.khronos.org/vulkan/)
`1.3.261.1` | `all` | [![Build Status](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_vulkan.yml/badge.svg)](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_vulkan.yml)
[![NuGet](https://img.shields.io/nuget/v/XenoAtom.Interop.vulkan.svg)](https://www.nuget.org/packages/XenoAtom.Interop.vulkan) |
| [XenoAtom.Interop.libdrm](src/libdrm)
libdrm is a userspace library that provides a user-space API to the Direct Rendering Manager. | [libdrm](https://gitlab.freedesktop.org/mesa/drm)
`2.4.120` | `linux` | [![Build Status](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_libdrm.yml/badge.svg)](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_libdrm.yml)
[![NuGet](https://img.shields.io/nuget/v/XenoAtom.Interop.libdrm.svg)](https://www.nuget.org/packages/XenoAtom.Interop.libdrm) |
| [XenoAtom.Interop.libgbm](src/libgbm)
libgbm is a userspace library that provides an abstraction for buffer management used by graphics drivers. | [libgbm](https://gitlab.freedesktop.org/mesa/mesa)
`24.0.9` | `linux` | [![Build Status](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_libgbm.yml/badge.svg)](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_libgbm.yml)
[![NuGet](https://img.shields.io/nuget/v/XenoAtom.Interop.libgbm.svg)](https://www.nuget.org/packages/XenoAtom.Interop.libgbm) |
| [XenoAtom.Interop.libshaderc](src/libshaderc)
libshaderc is a library for compiling GLSL/HLSL to SPIR-V. | [libshaderc](https://github.com/google/shaderc)
`2024.0` | `all` | [![Build Status](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_libshaderc.yml/badge.svg)](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_libshaderc.yml)
[![NuGet](https://img.shields.io/nuget/v/XenoAtom.Interop.libshaderc.svg)](https://www.nuget.org/packages/XenoAtom.Interop.libshaderc) |
| [XenoAtom.Interop.libkmod](src/libkmod)
libkmod is a library for managing kernel modules. | [libkmod](https://github.com/kmod-project/kmod/)
`32` | `linux` | [![Build Status](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_libkmod.yml/badge.svg)](https://github.com/XenoAtom/XenoAtom.Interop/actions/workflows/ci_build_libkmod.yml)
[![NuGet](https://img.shields.io/nuget/v/XenoAtom.Interop.libkmod.svg)](https://www.nuget.org/packages/XenoAtom.Interop.libkmod) |

- `all`: The library is available for all supported architectures.
- For `musl` library, it will work if `musl` is installed on the system. Typically on Alpine Linux you don't need to install anything.
So the targets `linux-musl-x64` and `linux-musl-arm64` are supported by default.

## 📜 User Guide

Coming soon! 🤞

## 🪪 License

This software is released under the [BSD-2-Clause license](https://opensource.org/licenses/BSD-2-Clause).

## 🤗 Author

Alexandre Mutel aka [xoofx](https://xoofx.github.io).