Skip to content

Add C# / .NET bindings (OxBitNet)#27

Merged
m96-chan merged 1 commit intomainfrom
csharp-bindings
Mar 6, 2026
Merged

Add C# / .NET bindings (OxBitNet)#27
m96-chan merged 1 commit intomainfrom
csharp-bindings

Conversation

@m96-chan
Copy link
Owner

@m96-chan m96-chan commented Mar 4, 2026

Summary

  • Add C# bindings wrapping oxbitnet-ffi via P/Invoke, targeting netstandard2.1 for Unity 2021.2+ compatibility
  • Thread-safe BitNet facade with IDisposable, sync/async Load/Generate/Chat APIs, GCHandle-pinned callbacks
  • NativeLoader with NativeLibrary.SetDllImportResolver for platform-specific library resolution (runtimes/{rid}/native/)
  • Interactive ChatConsole example (net8.0 console app)
  • CI: version check for .csproj, build-nuget-natives job (4 platforms), publish-nuget job to nuget.org

Closes #7

Test plan

  • dotnet build the solution
  • Run ChatConsole example with a GGUF model
  • Verify streaming token output works
  • Verify Dispose() cleans up properly
  • Verify CI version check catches mismatched versions

🤖 Generated with Claude Code

P/Invoke wrapper over oxbitnet-ffi targeting netstandard2.1 for Unity 2021.2+
compatibility. Includes thread-safe BitNet facade, NuGet packaging with
platform-specific natives, ChatConsole example, and CI publish pipeline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@m96-chan m96-chan merged commit a61d2e2 into main Mar 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unity / C# bindings (oxbitnet-csharp)

1 participant