Discussion:
[Mono-list] JVM interactions
Julian Dolby
2017-09-06 18:55:58 UTC
Permalink
_______________________________________________
Mono-list maillist - Mono-***@lists.dot.net
http://lists.dot.net/mailman/listinfo/mono-list
David Curylo
2017-09-06 19:54:30 UTC
Permalink
Julian

This project is incredibly outdated, but it is a starting point, so better than nothing:

https://github.com/olympum/caffeine <https://github.com/olympum/caffeine>

-Dave
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
_______________________________________________
http://lists.dot.net/mailman/listinfo/mono-list
Jonathan Pryor
2017-09-11 18:43:24 UTC
Permalink
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
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
_______________________________________________
http://lists.dot.net/mailman/listinfo/mono-list
_______________________________________________
Mono-list maillist - Mono-***@lists.dot.ne

Loading...