MochiLibraries / Biohazrd

A framework for automatically generating binding wrappers for C/C++ libraries
MIT License
60 stars 8 forks source link

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

Open PathogenDavid opened 3 years ago

PathogenDavid commented 3 years ago

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.

PathogenDavid commented 3 years ago

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)