[Mono-dev] 2D array representation change

Robert Jordan robertj at gmx.net
Tue Mar 21 13:13:59 UTC 2017


On 20.03.2017 20:56, howard.rubin wrote:
> I'm using mono on Linux to call from C++ to C#. The 2D array representation
> returned from mono_method_full_name() to pass to mono_method_desc_new() has
> changed from int[2] to int[,]
>
> MyNamespace.MyClass:MyFunction (int*[2]*)
> (assembly compiled with Mono C# compiler version 4.0.3.0)
>
> MyNamespace.MyClass:MyFunction (int*[,]*)
> (assembly compiled with Mono C# compiler version 4.8.0.0)
>
> 1. What version of mono did this change in?
> 2. How can I find out in C++ what version of mono a C# assembly was compiled
> with?

It seems to be caused by this commit (debug-helpers.c):

https://github.com/mono/mono/commit/faf9dda1efe20d63e83ea7c405ff03c97c31be12

I.e., the representation of C# "int[,]" has been changed from
"int[2]" to "int[,]".

You could try to determine at compile-time which mono runtime
are you building against (use "pkg-config --modversion mono-2")
and adjust the debug helper monikers using conditional compilation.


I'd rather propose a much easier approach: Look up the method
using mono_class_get_method_from_name ().

Robert






More information about the Mono-devel-list mailing list