Skip to content

Commit 1043e04

Browse files
authored
Update README.md
1 parent 3c674d4 commit 1043e04

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# DirectN AOT
2-
This is an AOT-friendly version of [DirectN](https://github.com/smourier/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.
2+
This is an AOT-friendly version of [DirectN](https://github.com/smourier/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 9 and beyond, it won't work for version below 8 or with .NET Framework.
33

4-
This is a still work in progress although it's been stabilizing lately. If you want to discuss how, where, why, just create an issue.
4+
**.NET 8 is not supported as it has a dreadful bug https://github.com/dotnet/runtime/issues/96901 the causes crashes** (can someone explain to me why it's not been ported back to .NET 8?).
5+
6+
This is a still work in progress although it's been fairly stable now. If you want to discuss how, where, why, just create an issue.
57

68
* **DirectN** is the AOT-friendly version of DirectN.
79
* **DirectN.Extensions** is a set of utilities that are not mandatory, but quite useful for programming with DirectN (and interop in general).
@@ -31,7 +33,7 @@ The key points that drive how code is generated and built:
3133
* `unsafe` usage is as limited as possible.
3234
* 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.
3335
* 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?)
34-
* 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...
36+
* 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. This hack is inactive under .NET 9+.
3537
* 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.
3638

3739
# Installation
@@ -42,12 +44,28 @@ https://www.nuget.org/packages/DirectNAot/ and https://www.nuget.org/packages/Di
4244
# Direct3D11 minimal sample.
4345
The **DirectN.Samples.MinimalD3D11** sample here [https://github.com/smourier/DirectN/tree/master/DirectN/DirectN.WinUI3.MinimalD3D11](https://github.com/smourier/DirectNAot/tree/main/Samples/DirectN.Samples.MinimalD3D11) has been ported to C# from here: https://gist.github.com/d7samurai/abab8a580d0298cb2f34a44eec41d39d which features a minimal Direct3D11 *"'API familiarizer' - an uncluttered Direct3D 11 setup & basic rendering reference implementation, in the form of a complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion"* sample.
4446

45-
It's dependent on DirectN AOT, .NET 8 and ... that's it. Once built, the fully standalone .exe with *zero dependency* is only 4M bytes!
47+
It's dependent on DirectN AOT, .NET 9 and ... that's it. Once built, the fully standalone .exe with *zero dependency* is only 4M bytes!
4648

47-
Here is the output (believe me, it rotates):
49+
Here is the output (believe me, it rotates):
4850

49-
![Sample](/Assets/minimald3d11_pt3_aot.png?raw=true)
51+
<img alt="minimald3d11_pt3" src="/Assets/minimald3d11_pt3_aot.png?raw=true" width="50%">
5052

5153
Full credits go to d7Samurai: https://gist.github.com/d7samurai
5254

55+
# PDF view sample
56+
The **DirectN.Samples.PdfView** sample here [https://github.com/smourier/DirectN/tree/master/DirectN/DirectN.WinUI3.PdfView](https://github.com/smourier/DirectNAot/tree/main/Samples/DirectN.Samples.PdfView) is a fully non-Winforms, non-WPF, non-WinUI3 window GUI app that can display a PDF file's content.
57+
58+
It's dependent on DirectN AOT, .NET 9 and ... that's it. Once built, the fully standalone .exe with *zero dependency* is only 6M bytes!
59+
60+
It uses Windows (WinRT) PDF API so it demonstrates how to include WinRT (C#/WinRT) in a DirectN AOT application. It also demonstrates how to use the [Visual Layer](https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/ui/visual-layer-in-desktop-apps) (aka Direct Composition) in a Windows app without any pre-baked UI framework, only DirectN, some of its utilities and Windows.
61+
62+
<img alt="PDFView Sample" src="https://github.com/user-attachments/assets/2e62cdae-375f-4e24-9e9a-82ea15c91bb8" width="50%">
63+
64+
# Wice
65+
Wice (aka "Windows Interface Composition Engine") is a .NET UI engine for creating Windows application. It's not dependent on WPF nor Winforms, nor WinUI 2 nor 3, nor Windows XAML, nor UWP, it's another UI Framework. The way it works is somewhat inspired from WPF, but there is no technical dependency over it.
66+
It supports native-AOT deployment, through usage of DirectNAOT.
67+
68+
Check it out at https://github.com/aelyo-softworks/Wice
5369

70+
# WebView2 sample
71+
[WebView2Aot](https://github.com/smourier/WebView2Aot) is an AOT project, using DirectNAOT that exposes .NET 9+ AOT-compatible bindings 100% independent from WinForms or WPF for Microsoft's WebView2.

0 commit comments

Comments
 (0)