NativeExposer 1.1.0
dotnet add package NativeExposer --version 1.1.0
NuGet\Install-Package NativeExposer -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="NativeExposer" Version="1.1.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NativeExposer" Version="1.1.0" />
<PackageReference Include="NativeExposer"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NativeExposer --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NativeExposer, 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.
#:package NativeExposer@1.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NativeExposer&version=1.1.0
#tool nuget:?package=NativeExposer&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NativeExposer
Do not write glue code yourself!
Preserving all API data, NativeExposer generates glue codes automatically to host C# from C++, without NativeAOT or IPC:
- C#
class Program
{
[Export]
public Program() {}
[Export]
public void Hello() {
Console.WriteLine("Hello, World");
}
}
- C++
clr::assert(clr::init("<dotnet-root>", "<runtimeconfig.json>"));
clr::assert(clr::load("<your-dll>"));
Program program;
program.Hello();
clr::close();
Getting Started
- Install
NativeExposer.Build
to system
dotnet tool install -g NativeExposer.Build
It installs native-exposer
build tool to your system.
- Add
NativeExposer
to csproj as dependency
<PackageReference Include="NativeExposer" Version="1.0.0"/>
- Use custom builder to generate stubs
native-exposer <csproj> <output-path>
It generates CMakeLists.txt
, lib.cxx
and lib.h
.
You can use this CMakeLists.txt
from your CMake project as add_subdirectory
or etc...
- Enjoy it!
Requirements
- .NET 5 or above
Current Limitation
- Cannot export properties
- Broken when trimming or NativeAOT
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.CSharp (>= 4.12.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.