Two (possibly dumb) questions:
- How do you write glue code? It looks like libA_core is unable to call to libB or libC, so if libB tries to pass through to libC, it can't be done.
- Would this prevent the compiler from doing things intelligently? Under the earlier suggestions, the code (including the representation annotations) are available to the compiler from the start (they are likely to be in the same crate, if not in the same module), whereas this proposal sounds like the compiler will only be able to do linkage-level optimization tricks. If the compiler has full information and access right from the start (with the source code), it may be able to choose a layout in memory that is in the intersection of both ABIs1, making the translation a zero-cost abstraction.
1The example I'm thinking about involves byte alignment of certain types. Some ABIs require alignment along some byte boundary, whereas others will permit misalignment. If the compiler is aware that some pair of objects are going to be interrelated in some manner, it may choose to align everything along the byte boundary that both ABIs find acceptable.