[Mono-dev] PrelinkAll leads to assertion failure
Martin Däumler
mdae at cs.tu-chemnitz.de
Tue Jan 3 07:34:07 EST 2012
Hello,
I wanted to use Marshal.PrelinkAll() in order to pre-initialize a
PInvoke. Unfortunately, executing this method leads to an assertion
failure on x86/Linux. The C# code is quite simple:
using System;
using System.Runtime.InteropServices;
class Test1
{
[DllImport("libpinvoke")]
public static extern int pinvoke(int value);
static void Main (string[] args)
{
Marshal.PrelinkAll(typeof(Test1));
int ret = pinvoke(1);
Console.WriteLine("return value: " + ret.ToString());
}
}
.. as well as the library code (pinvoke.c):
int pinvoke( int value ) {
return value;
}
The full example including Makefile can be downloaded [1].
Surprisingly, the assertion is raised by Mono 2.6.1 and
2.10.7, but not by Mono 2.8.2 (the versions I tested).
Further, the assertion is not raised when the C# code
was AOT-compiled in advance (works with each tested Mono
version).
Is it a bug or a feature?
With kind regards,
Martin Däumler
[1] http://www-user.tu-chemnitz.de/~mdae/PrelinkAllTest.tar
More information about the Mono-devel-list
mailing list