[Mono-dev] [PATCH] Win32 pinvoke3 runtime tests fixes

Bill Holmes billholmes54 at gmail.com
Thu Jul 17 19:14:54 EDT 2008


Hello All,

I did some investigation on Win32 about why the pinvoke3 runtime test
was failing.  What I found was a calling convention error in the test,
and two struct marshaling bugs.

For the calling convention problem I simply added a __stdcall
statement in libtest.c to the function pointer declaration that was
missing it.

The two calling convention bugs I was able to handle in the epilog.
See comments in patch for more detail.

The final problem I found was similar to a problem I observed before
when working on Winx64.  Zoltan fixed the problem with r104552 so I
decided to take a chance and try that fix out for x86 and the problem
went away.

One last thing to point out is that this test does not even run on
.NET.  Does this mean that Mono is better than .Net in this case?  ;)

Unhandled Exception: System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.Runtime.InteropServices.MarshalDirectiveException: Method's
type signature is not PInvoke compatible.
   at Tests.mono_test_marshal_delegate2(SimpleDelegate2 d)
   at Tests.test_0_marshal_struct_delegate()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target,
Object[] arguments, SignatureStruct& sig, MethodAttributes
methodAttributes, RuntimeTypeHandletypeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target,
Object[] arguments, Signature sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture)
   at TestDriver.RunTests(Type type, String[] args)
   at TestDriver.RunTests(Type type)
   at Tests.Main()

-bill


More information about the Mono-devel-list mailing list