[Mono-list] JVM interactions

Jonathan Pryor jonpryor at vt.edu
Mon Sep 11 18:43:24 UTC 2017


If you’re willing to do some work, may I suggest a third option? Java.Interop:

	https://github.com/xamarin/Java.Interop/
	https://gitter.im/xamarin/xamarin-android

Java.Interop is the “core” JNI glue and binding generator code that Xamarin.Android uses. This means two things:

1. It works!
2. The primary platform is *Android*, not a Desktop JVM.

Java.Interop *does* contain unit tests which run on a desktop JVM. However, most development occurs on macOS and Linux. There is also at least one bug around the GC integration in there, and `tools/generator` emits C# bindings which are specific to Xamarin.Android use, not “pure” Java.Interop use.

We have plans to address those issues, but no concrete timeframe to actually do so.

All that aside…it’s difficult to suggest what you’re doing “wrong” without some form of stack trace, code, or any other avenue of investigation. “SIGSEGV in the GC” could mean *lots* of things.

 - Jon

On Sep 6, 2017, at 2:55 PM, Julian Dolby <dolby at us.ibm.com> wrote:
>  I have been trying to use C# code together with Java code, to provide program analysis of .NET code as part of WALA (https://github.com/wala/WALA).  Given the seeming end of work on IKVM, I have been exploring using a small amount of C++ code and JNI to bridge the two systems.  I have tried two options:
>  
> 1) a C++ program that create a Mono VM and a JVM, loading the needed code into both and then calls functions in the them.  The Java code contains 'native' methods that call back into C++ and from there to Mono.
>  
> 2) a Java program that calls C++ using JNI, which creates a Mono VM and calls code in it, passing results (integers and strings) back to Java.
>  
>  In both cases, I get code that works fine up to a point, and then crashes with what appears to be a segmentation fault in the Mono memory allocator.  Depending on what GC I choose, I get slightly different errors.
>  
>  Does anyone have a recommended recipe for doing what I need?
>  
>     Thanks,
>           Julian
>  
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.dot.net
> http://lists.dot.net/mailman/listinfo/mono-list



More information about the Mono-list mailing list