3 ms·
It's probably possible to create a situation where a JVM process calls Rust code which then calls back to some Java function, if you're inclined to spend enough
by jbooth 12y ago
It's probably possible to create a situation where a JVM process calls Rust code which then calls back to some Java function, if you're inclined to spend enough time hacking with JNI (is it possible to pass a function pointer out of JVM land?). But if you started as a native Rust process, there's no JVM runtime to call into, you'd need start that up first.
- tormeh 12y agoCan't Rust just use the OS to start a JVM?
- the_why_of_y 12y agoIt's definitely possible to bootstrap the JVM in-process but there are quite some steps to it and it requires a bunch of platform dependent code to locate and load the library via LoadLibrary(jvm.dll) / dlopen(libjvm.so). IIRC the JNI functions all have C linkage so it should be easy to do from Rust.