Use Java as “scripting” language in C++ -


this question has answer here:

let’s i’m designing cross-platform application in c++ can user-extended through add-ons. application offer c++ api , load dynamic objects (.so, .dll, etc.). but, cumbersome users have compile 6 target platforms (windows x86/x86-64, macos x x86/x86-64 , gnu/linux x86/x86-64).

in order keep portability, thought of providing ruby api using libruby. little work came proof of concept. problem i’m worried performances. these add-ons may big , cruby isn't fast.

then thought, why not java?

  • java bytecode has better runtime performances, jit;
  • it portable;
  • distribution simple, users have provide jar;
  • users can provide closed-source add-ons (even if decompiling java bytecode not hard);
  • more people know java ruby.

the question now, how achieve this? made research , found out jni (java native interface). seems, though, able “call” c++ java , not other way around.

you can use jni invocation api, allows launch vm c or c++.

once you've launched vm, jni specification lists many other c functions interacting java.

i made research , found out jni (java native interface). seems, though, able “call” c++ java , not other way around.

you're looking @ native functions, allow define java methods in c.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -