Hello ;-)
I have a very-well working Java application.
That application uses a native library.
That native library use callback methods from main java application.
I want to create a independent wrapper-class that could be used be other applications.
How can i do that and how to code for other application to use that wrapper-class ?
PS : Note that the callback methods from main java application do call to native methods...
Code:Here the working code : public class test { // The native library declarations. // // => how to have a independant class ? // public static native void nativemethod1(String t); public static native void nativemethod2(int i, int j); public static native void nativemethod3(); static {System.loadLibrary("mylib");} ... // The callback methods used by library // public static void method1() // callback used by nativemethod1 { nativemethod3() ; } public static void method2() // callback used by nativemethod2 { nativemethod1("Hello") ; } public static void method3() // callback used by nativemethod3 { nativemethod1(1,2) ; } ... // The main application // public static void main(String[] args) { nativemethod1(); nativemethod2(); nativemethod3(); ... } }
I would do a separate class like that, that could be accessed by other Java application :
But how must i do to use that wrapper inside the other java applications ?Code:public class TheWrapper { // The native library declarations. // // => how to have a independant class ? // public static native void nativemethod1(String t); public static native void nativemethod2(int i, int j); public static native void nativemethod3(); static {System.loadLibrary("mylib");} ... }
Many thanks.
Fred.




Reply With Quote
