BGCS 2.0.4

dotnet add package BGCS --version 2.0.4
                    
NuGet\Install-Package BGCS -Version 2.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BGCS" Version="2.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BGCS" Version="2.0.4" />
                    
Directory.Packages.props
<PackageReference Include="BGCS" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BGCS --version 2.0.4
                    
#r "nuget: BGCS, 2.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BGCS@2.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BGCS&version=2.0.4
                    
Install as a Cake Addin
#tool nuget:?package=BGCS&version=2.0.4
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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