.class to shared library?

Bryce McKinlay bryce@albatross.co.nz
Mon Dec 4 18:14:00 GMT 2000


Shane Jarych wrote:
> Support I have a C program that calls a shared-library function with signature
> 'void speak(char *words)'. speak() is a simple C function compiled as into a
> shared-library.
>> Now suppose I write this function in a Java class, and create a shared library
> from it.

> How would the originating C program call upon the Java version of 'speak()'?

Right now, if your program has a C "main" method, you can't do that. Eventually
we want to have a CNI invocation interface, where you can initialize the java
runtime from inside your C++ program. Once we have this we'll also support JNI
invocation, which you can use if you need to do it from pure-C (not C++) code.
Right now you can, however, happily have a Java main class which calls into C++
code which, in turn, calls back into your Java code. Its just a matter of having
things like the threads environment and the GC initialized correctly before your
start making Java calls.
I suggest you search the list archives if you want more info - this has been
discussed before.
regards
 [ bryce ]


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /