Hi,
I have a simple C# project build of a console application (Tester.exe) and a
DLL (TesterDll.dll) referenced by it, I am trying to figure out the way a
method of TesterDll is identified in Tester.exe, how does Tester.exe know to
resolve the token that resemble a method defined in TesterDll? Let’s take in
mind the following Tester.exe code segment:
…
TesterDll.CTester t = new TesterDll.CTester();
…
How does the .ctor() of TesterDll.CTester is resolved by Tester.exe? does
the .ctor() token is embedded in the IL Code of Tester.exe? OR rather, does
the method full name is embedded in Tester.exe IL and during DLL loading the
names are resolved and replaced by real RVAs?
Is it possible to use ildasm to trace a method call in this manner ( e.g.
according to the method token and not according to it’s name )?
Any remarks, pointers or samples would be appreciated.
The DLL (TesterDll.dll):
namespace TesterDll
{
public class CTester
{
public CTester() {}
}
}
The Console (Tester.exe):
namespace Tester
{
class Class1
{
void Print(string strMsg)
{
// How does TesterDll.CTester this method is
// identified in Tester.exe IL?
TesterDll.CTester t = new TesterDll.CTester();
}
[STAThread]
static void Main(string[] args)
{
Class1 c = new Class1();
c.Print(0 == args.Length ? "" : args[0]);
}
}
}
--
Nadav
http://www.ddevel.com