Sharing output streams through a JNI interface
- by Chris Conway
I am writing a Java application that uses a C++ library through a JNI interface. The C++ library creates objects of type Foo, which are duly passed up through JNI to Java.
Suppose the library has an output function
void Foo::print(std::ostream &os)
and I have a Java OutputStream out. How can I invoke Foo::print from Java so that the…