vtable 和 MSIL
我必须教抽象类和接口之间的区别。它可以帮助我回答以下问题。请帮我!!! 是否可以使用ILdasm查看vtable的内容?我想看一个例子来展示抽象类的 vtable 和 IL 语言中的接口之间的区别。
I have to teach the difference between abstract class and interface. It could help me the answer to the following question. Please help me!!!
Is it possible to see the content of vtable using ILdasm? I would like to see an example that show the difference between vtable in case of an abstract class and an interface in IL language.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,vtable 是由 CLR 类加载器在运行时构建的。你当然可以猜到它,它包含根据类或接口声明指向 jitted 方法的指针。
演示它需要查看生成的机器代码并使用“反汇编”和“内存 1”窗口。请务必使用发布版本或关闭“编辑+继续”,这会增加一个额外的间接层。
No, the vtable is built at runtime by the CLR class loader. You can certainly guess at it, it contains pointers to the jitted methods according to the class or interface declaration.
Demonstrating it requires looking at the generated machine code and using the Disassembly and Memory 1 windows. Be sure to either use the Release build or turn Edit + Continue off when you do, it adds an extra layer of indirection.