DirectNAot 1.1.0

dotnet add package DirectNAot --version 1.1.0                
NuGet\Install-Package DirectNAot -Version 1.1.0                
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="DirectNAot" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DirectNAot --version 1.1.0                
#r "nuget: DirectNAot, 1.1.0"                
#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.
// Install DirectNAot as a Cake Addin
#addin nuget:?package=DirectNAot&version=1.1.0

// Install DirectNAot as a Cake Tool
#tool nuget:?package=DirectNAot&version=1.1.0                

DirectN AOT

This is an AOT-friendly version of DirectN. Aimed at x64 targets (doesn't mean it won't work for x86 targets, but it may not work for ambiguous types) . Only for .NET Core 8 and beyond, it won't work for version below 8 or with .NET Framework.

The key points that drive how code is generated and built:

  • The goal for DirectN is to create built-in interop code for modern media & graphics Windows (cross-platform is not a target) technologies only:
    • DirectX (9 ⇒ 12)
    • Direct2D
    • DXGI
    • Media Foundation
    • Windows Imaging Component (WIC)
    • Direct Composition
    • Direct Write
    • Audio (WASAPI)
    • XPS
    • others (dependencies, etc)
  • Modern code exclusively based on .NET 8 newer source-generated LibraryImport, source-generated `ComWrappers, etc.
  • How it works and how it's made is, at its root, completely driven by .NET 8 ComWrapper source generator and AOT requirements: trimming, and disabled runtime marshaling.
  • DirectN is AOT-friendly.
  • unsafe usage is as limited as possible.
  • Raw pointers (like ISomething*) usage is not publicly exposed, only interface types (like ISomething), or nint depending on the situation. object as out parameter type for untyped (native void**) COM interfaces has been considered but it's been replaced by nint which is more universal, including for authoring (aka implementing COM interfaces in .NET) scenarios.
  • All ComObject instances are created using ComWrappers' "unique instance" (CreateObjectFlags.UniqueInstance and UniqueComInterfaceMarshaller<>) marshalling feature, as we want to control when objects are released (what's the serious use of non-unique instances in interop scenarios anyway?)
  • Due to the usage of unique instances everywhere in DirectN AOT, we had to add a hack to overcome a nasty .NET 8 bug https://github.com/dotnet/runtime/issues/96901 or everything crashes very quickly at GC or finalizing time. We want to remove this hack ASAP, but it's not sure if this bug will be only released with .NET 9 or before...
  • Doing interop is inherently unsafe but we want to keep a .NET-like programming whenever possible. The generated code serves a similar purpose to the CsWin32 project, but the final generated code and net result (ie: how we use it as a caller) are quite different.
Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DirectNAot:

Package Downloads
DirectNAot.Extensions

Extensions code for DirectNAOT package: Com utilities, Extension methods, Windows utilities, DXC utilities, etc.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 55 2/3/2025
1.0.0 112 1/5/2025