I’m always looking for a diverse set of fun projects where I can show the strengths of Native AOT. So today I will write about DirectX. Technically,

DirectX in NativeAOT

submited by
Style Pass
2021-06-21 22:00:09

I’m always looking for a diverse set of fun projects where I can show the strengths of Native AOT. So today I will write about DirectX. Technically, DirectX is just another COM library, and because I wrote about COM in NativeAOT earlier, it’s nothing special in that regards. What’s new in this article is that today I will use source generators to quickly create a ComWrappers instance ready to use within my small application.

As a starting point, I will again take Winterop library from Jeremy Kuhne. If at any point you become bored, go directly to source code and play with the sample.

So what’s currently needed to make NativeAOT and COM spin? Usually, I start porting the application to NativeAOT with the following simple steps. I create a new blank ComWrappers class.

UniversalWrapper here, is a class that will serve as generic runtime callable wrapper for all COM objects that I will use in the application.

Leave a Comment