Extended NativeAOT library tooling #77833
Unanswered
Danielku15
asked this question in
Q&A
Replies: 1 comment 2 replies
-
If that can help, this is an approach I experimented with: https://www.youtube.com/watch?v=eE0AbO5_XSw&ab_channel=Dotnetos Is it the kind of thing you had in mind? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
With the Native AOT landing in .net 7 I was wondering about the plans around providing a reverse C++/CLI experience.
The https://github.com/dotnet/samples/tree/main/core/nativeaot/NativeLibrary shows a very (very) basic example how to expose functionality written in .net to the Native world but realistically it is not really feasable to write some advanced libraries in .net.
As a library author you need to:
Instantly my code-generation bells were ringing and I concluded: This has to be automatable in some tooling. Just like https://github.com/mono/CppSharp is doing this from the C++ world to the .net world it would be amazing to have a certain tooling which allows you to expose selected classes/namespaces "simply" to the native world with an OOP experience.I started with a very hacky PoC for my library to use a Source Generator for generating the C-style layer and beside some aspects like generics I made quickly some good progress.
Of course quite some complexities have to be solved to ensure correct memory management (GCHandle pinning) and marshalling of types to avoid unexpected side effects.
Have there been any discussions towards such a tooling?
Beta Was this translation helpful? Give feedback.
All reactions