Looking for a convenient way to call Java from C++

前端 未结 9 872
醉话见心
醉话见心 2021-01-30 13:55

It seems most documentation or helper libraries relating to JNI (Java Native Interface) are concerned with calling native code from Java. This seems to be the main use of it, ev

9条回答
  •  遥遥无期
    2021-01-30 14:21

    Answering my own question:

    http://java4cpp.kapott.org/

    Doesn't appear to be an active project. The author recommends it not be used with JDK 1.5 or later.

    It appears to have a serious problem: it passes around naked pointers to its wrapper objects:

    java::lang::Integer* i = new java::lang::Integer("10");
    
    delete i; // don't forget to do this!
    

    It also causes a more subtle problem that in order to represent assignment compatibility (e.g. a class as a subtype of the interface it implements) the wrappers have to inherit from each other.

提交回复
热议问题