2D array representation change

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

2D array representation change

howard.rubin
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?

Howard Rubin



--
View this message in context: http://mono.1490590.n4.nabble.com/2D-array-representation-change-tp4670301.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.dot.net/mailman/listinfo/mono-devel-list
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 2D array representation change

Robert Jordan
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




_______________________________________________
Mono-devel-list mailing list
[hidden email]
http://lists.dot.net/mailman/listinfo/mono-devel-list
Loading...