Search code examples
androiddalviksmali

what's the difference between invoke-virtual and invoke-direct in android


It said that invoke-virtual is invoking the virtual method, while invoke-direct is the direct method.

However I'm not clear what is "virtual method" and what is "direct method"?

In other words, what kind of method invoking will be invoke-virtual and what kind will be invoke-direct?

Can anyone give some concrete example?


Solution

  • From http://source.android.com/devices/tech/dalvik/dex-format.html, a direct method is "any of static, private, or constructor".

    However, static methods get their own invoke-static opcode, so invoke-direct is used for constructors and private methods.