Skip to content

Two way C# <-> C/C++ bindings #8

@FiniteReality

Description

@FiniteReality

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions