Hello.
I know that it is not the good place to ask it.
But... i ask it to many Java forum, to CodeGuru, to StackOverflow,... no answer.
I understand also that, because here it is a Pascal forum, you do not want to see other languages code.
PS : I asked to Code::Block some help to translate a Pascal procedure into a C procedure and i get a PM => "Other languages than C are not allowed, your topic will be deleted..."
So if this topic has nothing to do here, please advice, i will destroy it immediately.
Now, the thing.
I have successfully compiled some universal fpc libraries for using it with Java (using jni.pas).
I have done some test with Java code and the link with those native-java-compatible fpc libraries is perfect.
Now i want to create a independent Java Class who will be a wrapper to the fpc library.
But im not a Java programmer and in all the Java doc i find i do not find how they do it.
Here the topic i sent to several Java-forum:
__________________________________________________________
Hello good Java people.
I have a very-well working Java application.
That application uses a native library.
That native library uses callback methods from main java application.
I want to create a independent wrapper-class that could be used be other Java 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 does call to native methods...
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 :
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");}
...
}
But how must i do to use that wrapper inside the other java applications ?
Many thanks.
_________________________________________
So if somebody here knows the answer (or where i can find it), i will be very happy.
Many thanks.
Fred