tags:

views:

80

answers:

1

I am able to call C++ code from Java using SWIG but I can't find any documentation on how to do the reverse (call Java from C++).

The official SWIG documentation says (http://www.swig.org/Doc1.3/Java.html#java_overview): "SWIG enables a Java program to easily call into C/C++ code from Java. Historically, SWIG was not able to generate any code to call into Java code from C++. However, SWIG now supports full cross language polymorphism and code is generated to call up from C++ to Java when wrapping C++ virtual methods."

But I can't find where it says how to do it! Any help is greatly appreciated. Thank you.

+1  A: 

Based on the rather strange wording of the statement I'd say what you want isn't generally possible. "...call up from C++ to Java when wrapping C++ virtual methods." The "...call up..." leads me to believe you're calling protected or public members of an inherited interface and, "...when wrapping C++ virtual methods," leads me to conclude you can only do so when you're overriding an inherited interface. So it sounds like the actual use case is very narrow.

But then, I'm just basing this on the wording of the text you've pasted. It may or may not help you.

Noah Roberts