ddss
ddss

Reputation: 11

Is it possible to call java method from C code with SWIG generated JNI?

I am trying to use SWIG to generate my JNI. I already have JNI code that is working, but it is hand written and it is getting more and more complicated and difficult to maintain.

Some of my functions in C are called from Java, and then they call some methods in Java (probably it is not a good idea, but it is working for now)...

I am wondering if it is possible for SWIG to generate that kind of JNI code?

Upvotes: 1

Views: 1521

Answers (2)

GooseSerbus
GooseSerbus

Reputation: 1270

The only JNI wrappers of this type I'm aware of are Jace and JunC++ion, both of which are C++ based so don't fit your needs.

Upvotes: 0

Mårten Wikström
Mårten Wikström

Reputation: 11344

Yes it should be possible.

The following languages are also supported in swig-1.3.6 onwards: Java JDK 1.1 and newer.

Quoted from http://www.swig.org/compat.html

More info here:

UPDATE: For more info on calling Java from C++ have a look at: http://www.swig.org/Doc1.3/Java.html#java_directors

Upvotes: 2

Related Questions