How are the generic functions and types stored in an rlib?

前端 未结 1 523
名媛妹妹
名媛妹妹 2021-02-12 18:02

In C++, the templates can not be generated into dynamic libraries, we can only use them by header files.

In C#, generic functions and types can be interpreted by interme

相关标签:
1条回答
  • 2021-02-12 19:01

    An rlib is a regular static library (built in the ar format) that contains additional metadata. That metadata contains, among other things, the complete, serialised abstract syntax tree (AST) for all generics and functions marked with #[inline].

    It's a bit like if there was a C++ compiler that shoved a library's header files into the compiled binary, and then read them out again when linking against that library.

    0 讨论(0)
提交回复
热议问题