[Mono-dev] Resolving RVA of method calls in external libraries

Jonathan Pryor jonpryor at vt.edu
Thu Jun 8 07:22:31 EDT 2006

On Wed, 2006-06-07 at 13:04 -0300, Joey Libby wrote:
> Hi, I was wondering if anyone could explaint to me how the metadata
> tokens that point to a method in an external library are resolved to
> find the metadata entry for that method in the given library and from
> that the RVA of the method. All I currently see is that there is a
> reference to the name and library name in the metadata of the main cli
> program. Thanks in advance. 

The RVA of the target method is never resolved by mono.  The RVA of the
target method is resolved by the operating system's dynamic linker, and
an RVA may in fact never be involved (IIRC ELF doesn't use RVAs, so the
RVA terminology is incorrect under most Unix platforms).

What instead happens is that the method name + library name are
extracted from the assembly metadata, the specified library is loaded
(ultimately via dlopen(3) or LoadLibrary()), and the specified method is
retrieved (ultimately via dlsym(3) or GetProcAddress()).  Mono doesn't
actually using any of these APIs, but instead uses the GModule API
(g_module_open(), g_module_name(), etc.), which in turn uses these
underlying APIs.

 - Jon

More information about the Mono-devel-list mailing list