Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Latest commit

 

History

History
39 lines (35 loc) · 1016 Bytes

README.md

File metadata and controls

39 lines (35 loc) · 1016 Bytes

.NET Library for Native Apps

dotnet AOT support is now out, this project will be archived as it is now officially suported

Steps from scratch

  • Create a new project
    dotnet new classlib -o DotNetLib
  • add NativeAOT support by creating a nuget config
    cd DotNetLib
    dotnet new nugetconfig
  • Add the following to the nuget.config file:
    <add key="dotnet-experimental" value="https://pkgs.dev.azure.com/dnceng/public/  _packaging/dotnet-experimental/nuget/v3/index.json" />
  • add a reference to the compiler
    dotnet add package Microsoft.DotNet.ILCompiler -v 7.0.0-*
  • then you can publish the dll like this
    dotnet publish /p:NativeLib=Shared /p:SelfContained=true -r <RID> -c <Configuration>

Cpp steps

  • make and build the native executable
    meson builddir
    meson compile -C builddir
  • put the library in the executable generated by meson (buiddir/cpp)
  • run it
    ./builddir/bin/<executable>