Biohazrd icon indicating copy to clipboard operation
Biohazrd copied to clipboard

Provide a mechanism for TranslatedTypeReference types to resolve references across library bounds

Open PathogenDavid opened this issue 3 years ago • 1 comments

When testing Biohazrd with the DirectX API, I decided to split the API surface across various C# assemblies (IE: DXGI, D3D12, etc.)

I implemented this by splitting the TranslatedLibrary into multiple libraries. This worked pretty well, but I've had some pains around references which span the library boundaries. I have a transformation which looks for translated type references which will span library boundaries once the split is finished and rewrites them to (my self-implemented) ManuallyImplementedTypeReference. This unsurprisingly does not play nice with declarations which override how they are referenced.

The situation is workable, but I'm not sure if it would work nice in a more complex setting.

  • Add proper support to the output generation to split the library as it is written.
  • Add some mechanism for libraries (or things which resolve type references) to know about sibling libraries.
  • Provide a type reference which has a library reference which can resolve across boundaries. (This may be the simplest, but could be error-prone to use.)

PathogenDavid avatar Jan 21 '21 07:01 PathogenDavid

This came up again with type references in metadata which broke due to the splitting breaking their references. (Related: https://github.com/InfectedLibraries/Biohazrd/issues/151)

PathogenDavid avatar Jan 24 '21 11:01 PathogenDavid