[Mono-dev] __arglist and P/Invoke

Argiris Kirtzidis akyrtzi at gmail.com
Sun Dec 31 11:31:10 EST 2006


Hi,

Mono isn't able to handle __arglist in a P/Invoke signature. For example, the following program (which calls 'printf' of the the standard C library) is working fine with MS.NET.

using System.Runtime.InteropServices;

class Program
{
    [DllImport("msvcrt.dll")]
    public static extern void printf(string format, __arglist);

    static void Main()
    {
        printf("number %d\n", __arglist(10));
    }
}


If I try to use Mono, I encounter two problems:

1) The Mono C# compiler doesn't add 'vararg' to the method definition for printf.
2) If I try to execute the sample (compiled with MS.NET's C# compiler) a internal exception is thrown:

Unhandled Exception: System.InvalidProgramException: Invalid IL code in Program: Main (): IL_0008: call      0x0a000011


Are these problems likely to be fixed in a future version of Mono ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061231/fb8a2899/attachment.html 


More information about the Mono-devel-list mailing list