Tech Off Thread

1 post

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

"instance explicit" calling convention

Back to Forum: Tech Off
  • User profile image
    TomasDeml

    Hi!

    I'm playing with IL a bit and I came over the "instance explicit" calling convention. But I have a problem: ILAsm compiles my program but CLR throws the "method void Foo::Bar() not found" exception.

    Here goes the program:

    .assembly extern mscorlib {}
    .assembly Test {}
    .module Test.exe
    
    .class private auto ansi Foo extends [mscorlib]System.Object 
    {
        .method public specialname void .ctor() cil managed
        {
            ldarg.0 
            call instance void [mscorlib]System.Object::.ctor()
            ret
        }
        
        .method public void Bar(class Foo) cil managed
        {
            ret
        }
    }
    
    .class private auto ansi EntryClass extends [mscorlib]System.Object
    {
        .method public static void EntryPoint() cil managed
        {
            .entrypoint
            newobj instance void Foo::.ctor()
            call instance explicit void Foo::Bar(class Foo)
            ret
        }
    }
    


    I reviewed the CLI ECMA Specs to find out more about the "instance explicit" calling convention and it says:

    CLI Specs wrote:

    Normally, a parameter list  (which always follows the calling convention) does not provide information about the type of the this pointer, since this can be deduced from other information.  When the combination instance explicit is specified, however, the first type in the subsequent parameter list specifies the type of the this pointer and subsequent entries specify the types of the parameters themselves.


    Can somebody shed light on my problem?

    Thanks.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.