Finite.Cpp.Sdk
Finite.Cpp.Sdk copied to clipboard
Two way C# <-> C/C++ bindings
Two-way bindings without much hassle should be possible, eventually. I think this will likely take the form of a separate package reference to extend the build based on which SDK is being used.
For sharing types between managed and unmanaged, there are multiple routes that would likely need to be taken:
- Generate C# types and methods from existing C/C++ code (a la ClangSharp - https://github.com/Microsoft/ClangSharp) when referencing a C/C++ library from C#
- Generate C/C++ types and methods from the C# types, failing if the types are not blittable (a la DNNE) when referencing a C# library from C/C++
Some examples of the desired XML:
<Project Sdk="Finite.Cpp.Sdk">
<ItemGroup>
<PackageReference Include="Finite.Cpp.Sdk.DotNetExports" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="path/to/project.csproj" GenerateExports="true" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Finite.Cpp.Sdk.NativeExports" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="path/to/project.cxxproj" GenerateExports="true" />
</ItemGroup>
</Project>