BGCS 2.0.4
dotnet add package BGCS --version 2.0.4
NuGet\Install-Package BGCS -Version 2.0.4
<PackageReference Include="BGCS" Version="2.0.4" />
<PackageVersion Include="BGCS" Version="2.0.4" />
<PackageReference Include="BGCS" />
paket add BGCS --version 2.0.4
#r "nuget: BGCS, 2.0.4"
#:package BGCS@2.0.4
#addin nuget:?package=BGCS&version=2.0.4
#tool nuget:?package=BGCS&version=2.0.4
BGCS
BGCS is the embeddable BindGen-CS generator package. Use it when a build tool, source pipeline, or application needs to generate C# interop from C headers without shelling out to the bindgen-cs command.
For ordinary command-line use, install the BindGen-CS .NET tool instead. For C++ classes and templates, add BGCS.Cpp2C and generate a C ABI bridge first.
Install
dotnet add package BGCS
Projects that compile the generated bindings also need BGCS.Runtime, unless the configuration enables standalone runtime-source generation.
Generate from configuration
using BGCS;
CsCodeGenerator generator = CsCodeGenerator.Create("bindgen.json");
if (!generator.GenerateConfigured())
{
foreach (var diagnostic in generator.Messages)
Console.Error.WriteLine(diagnostic);
throw new InvalidOperationException("Binding generation failed.");
}
var module = generator.LastResult?.Module;
Paths in bindgen.json are resolved relative to the configuration file. Successful generation replaces the configured output transactionally, so custom code should live outside the generated directory.
What this package provides
- configuration loading, validation, presets, and target discovery;
- Clang-based C/C++ parsing and declaration analysis;
- a shared Binding IR with ownership and marshalling diagnostics;
- C# imports, native types, callbacks, constants, friendly overloads, patching, and optional standalone Runtime output;
DllImport,LibraryImport, and function-table/native-context import modes;- extension points for generation steps, function rules, parameter writers, patches, and IR emitters.
The primary configuration-driven C# output uses the IR-only CSharpEmitter. The pre-release compatibility emitter and old configuration migration path have been removed.
Start here
BindGen-CS is licensed under the MIT License. Portions derived from CppAst/HexaGen retain their original notices.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. 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 was computed. net10.0-android was computed. 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. |
-
net9.0
- BGCS.Core (>= 2.0.4)
- BGCS.Intermediate (>= 2.0.4)
- BGCS.Language (>= 2.0.4)
- Microsoft.CodeAnalysis.CSharp (>= 4.8.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.4 | 43 | 9/26/2026 |
| 2.0.3 | 42 | 9/25/2026 |
| 1.0.1 | 116 | 4/9/2026 |
| 1.0.0 | 118 | 4/9/2026 |
| 1.0.0-alpha.1 | 74 | 4/6/2026 |