This repository was archived by the owner on Nov 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 503
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
Multiple csproj projects referenced and using NativeCallable #7215
Copy link
Copy link
Open
Description
I can't seem to get multiple project using NativeCallableAttribute to expose these functions. Only the project that has the references (the project being compiled) has it's functions exposed as native callable functions.
Project A has a native function 'add':
[NativeCallable (EntryPoint = "add", CallingConvention = CallingConvention.StdCall)]
public static int Add (int a, int b) {
return a + b;
}Project B has a native function 'subtract':
[NativeCallable (EntryPoint = "subtract", CallingConvention = CallingConvention.StdCall)]
public static int Subtract (int a, int b) {
return a - b;
}- Project A has a project reference to Project B
- Project A is compiled
- I can only access Project A's 'add' function, the 'subtract' function is not available.
More Notes
Project A's nuget.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>Project A's csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
<NativeLib>Static</NativeLib>
<RootNamespace>HostA</RootNamespace>
<LangVersion>8.0</LangVersion>
<NullableContextOptions>enable</NullableContextOptions>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>8.0</LangVersion>
<NullableContextOptions>enable</NullableContextOptions>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>8.0</LangVersion>
<NullableContextOptions>enable</NullableContextOptions>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-*" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.*" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ProjectB\ProjectB.csproj" />
</ItemGroup>
<ItemGroup>
<RdXmlFile Include="rd.xml" />
<IlcArg Include="--stacktracedata" />
</ItemGroup>
</Project>Command used to build:
dotnet publish /p:NativeLib=Shared -r win-x64 -c releaseReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels