HexaGen.Runtime
1.1.24
Prefix Reserved
dotnet add package HexaGen.Runtime --version 1.1.24
NuGet\Install-Package HexaGen.Runtime -Version 1.1.24
<PackageReference Include="HexaGen.Runtime" Version="1.1.24" />
<PackageVersion Include="HexaGen.Runtime" Version="1.1.24" />
<PackageReference Include="HexaGen.Runtime" />
paket add HexaGen.Runtime --version 1.1.24
#r "nuget: HexaGen.Runtime, 1.1.24"
#:package HexaGen.Runtime@1.1.24
#addin nuget:?package=HexaGen.Runtime&version=1.1.24
#tool nuget:?package=HexaGen.Runtime&version=1.1.24
HexaGen
HexaGen is a comprehensive code generation toolkit for C# and C++ projects. It uses HexaGen.CppAst to parse C/C++ headers and automatically generates C# bindings and wrappers. HexaGen simplifies the process of integrating native libraries with C# applications by automating the creation of interop code.
✨ Features
- C# Bindings for C Libraries: Automatically generate C# bindings from C headers with support for functions, structs, enums, and callbacks
- C# Bindings for COM Libraries: Create C# bindings for COM interfaces and objects
- C++ to C Wrappers: Generate C wrappers around C++ libraries to facilitate C interop
- Flexible Configuration: JSON-based configuration system with inheritance and composition support
- Advanced Function Generation: Multiple parameter handling strategies including spans, refs, delegates, and default values
- Type Mapping: Configurable type mappings and conversions
- Extension Methods: Generate extension methods for improved API ergonomics
- Constants to Enums: Convert C preprocessor constants to strongly-typed C# enums
📁 Project Structure
- HexaGen - Main code generation tool and CLI
- HexaGen.Core - Core functionality and utilities for code generation
- HexaGen.Cpp2C - C++ to C wrapper generator
- HexaGen.Runtime - Runtime support library for generated code (multi-target: .NET 9/8/7/6, .NET Standard 2.0/2.1, .NET Framework 4.7.2, Android)
- HexaGen.Runtime.COM - Runtime support for COM interop (multi-target: .NET 9/8/7/6, .NET Standard 2.0/2.1, .NET Framework 4.7.2)
- HexaGen.Language - Language parsing and processing utilities
- HexaGen.Tests - Unit tests
- HexaGen.PerformanceTests - Performance benchmarks
🔧 Requirements
- .NET SDK 9.0 (or compatible version)
- Clang 17.0.4 or later (for parsing C/C++ headers)
- Visual Studio 2022 or later (recommended for development)
📦 Installation
NuGet Package
Install HexaGen via NuGet Package Manager:
dotnet add package HexaGen
Build from Source
Clone the Repository:
git clone https://github.com/HexaEngine/HexaGen.git cd HexaGenBuild the Project:
dotnet build
🚀 Usage
Basic Example
Create a configuration file (e.g., config.json):
{
"ApiName": "MyLibrary",
"Namespace": "MyLibrary.Generated",
"ImportType": "DllImport",
"GenerateExtensions": true
}
Generate C# bindings programmatically:
using HexaGen;
var config = CsCodeGeneratorConfig.Load("config.json");
var generator = new CsCodeGenerator(config);
generator.Generate("mylibrary.h", "Output");
⚙️ Configuration
HexaGen uses a JSON-based configuration system that supports:
- BaseConfig: Configuration inheritance from other files
- Type Mappings: Custom type conversions
- Function Rules: Advanced parameter transformation rules
- Constants to Enum: Convert preprocessor defines to enums
- Import Types: DllImport, LibraryImport, or delegates
Example configuration with inheritance:
{
"BaseConfig": {
"Url": "file://config.base.json",
"IgnoredProperties": ["IgnoredTypes"]
},
"ApiName": "MyAPI",
"Namespace": "MyAPI.Generated",
"ImportType": "LibraryImport"
}
C++ to C Generation
For generating C wrappers around C++ libraries:
using HexaGen.Cpp2C;
var config = Cpp2CGeneratorConfig.Load("cpp2c-config.json");
var generator = new Cpp2CGenerator(config);
generator.Generate("mylibrary.hpp", "Output");
🤝 Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes following the project's coding standards
- Add appropriate tests
- Submit a pull request
📜 License
HexaGen is licensed under the MIT License. See the LICENSE.txt file for details.
🔗 Links
- GitHub Repository
- NuGet Package
- HexaGen.CppAst - The underlying C++ parser (custom fork)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-android35.0 is compatible. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-android36.0 is compatible. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- System.Memory (>= 4.6.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.1.2)
-
.NETStandard 2.0
- System.Memory (>= 4.6.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.1.2)
-
.NETStandard 2.1
- System.Runtime.CompilerServices.Unsafe (>= 6.1.2)
-
net10.0
- No dependencies.
-
net10.0-android36.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
-
net9.0-android35.0
- Xamarin.AndroidX.Core (>= 1.15.0.1)
NuGet packages (54)
Showing the top 5 NuGet packages that depend on HexaGen.Runtime:
| Package | Downloads |
|---|---|
|
Hexa.NET.ImGui
A .NET wrapper for the Dear ImGui library. (1.92.3) |
|
|
Hexa.NET.ImPlot
A .NET wrapper for the ImPlot library. (0.17 / commit 3da8bd3) (for ImGui 1.92.3) |
|
|
Hexa.NET.ImNodes
A .NET wrapper for the ImNodes library. (0.5.0 / commit b2ec254) (for ImGui 1.92.3) |
|
|
Hexa.NET.ImGuizmo
A .NET wrapper for the ImGuizmo library. (1.91.3 WIP / commit 2310acd) (for ImGui 1.92.3) |
|
|
Hexa.NET.ImGui.Backends
A .NET wrapper for the Dear ImGui (1.92.3) library backends (Win32, Vulkan, OpenGL2, OpenGL3, D3D11, D3D12, OSX, Metal, Android). |
GitHub repositories (4)
Showing the top 4 popular GitHub repositories that depend on HexaGen.Runtime:
| Repository | Stars |
|---|---|
|
goatcorp/Dalamud
FFXIV plugin framework and API
|
|
|
vawser/Smithbox
Smithbox is a modding tool for Elden Ring, Armored Core VI, Sekiro, Dark Souls 3, Dark Souls 2, Dark Souls, Bloodborne and Demon's Souls.
|
|
|
HexaEngine/Hexa.NET.ImGui
A .NET wrapper for the Dear ImGui.
|
|
|
HexaEngine/HexaEngine
The official repo of the HexaEngine game engine
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.24 | 0 | 12/19/2025 |
| 1.1.23 | 228 | 11/1/2025 |
| 1.1.22 | 305 | 10/15/2025 |
| 1.1.21 | 5,874 | 7/20/2025 |
| 1.1.20 | 4,304 | 7/19/2025 |
| 1.1.19-b | 215 | 4/6/2025 |
| 1.1.18 | 9,740 | 4/3/2025 |
| 1.1.17 | 3,054 | 2/4/2025 |
| 1.1.16 | 7,711 | 11/13/2024 |
| 1.1.15 | 176 | 11/12/2024 |
| 1.1.14 | 3,999 | 11/11/2024 |
| 1.1.13 | 7,436 | 10/16/2024 |
| 1.1.12 | 162 | 10/16/2024 |
| 1.1.11 | 177 | 10/14/2024 |
| 1.1.10 | 1,171 | 10/10/2024 |
| 1.1.9 | 801 | 9/12/2024 |
| 1.1.8 | 522 | 8/21/2024 |
| 1.1.7 | 853 | 8/18/2024 |
| 1.1.6 | 399 | 8/13/2024 |
| 1.1.5 | 854 | 8/4/2024 |
| 1.1.4 | 552 | 7/31/2024 |
| 1.1.3 | 144 | 7/31/2024 |
| 1.1.2 | 132 | 7/31/2024 |
| 1.1.1 | 144 | 7/28/2024 |
| 1.1.0 | 436 | 7/28/2024 |
| 1.0.0 | 1,229 | 9/19/2023 |