> now the last obstacle : Callback procedures...
Hum, i do not find why it is not working ;-(
I follow jni c examples but with no luck.
Does somebody knows how to deal with callback procedures and Java ?
Here Library Pascal code :
procedure formonclick(PEnv: PJNIEnv; Obj: JObject; aproc: JString); cdecl;
begin
JMethod :=
(PEnv^^).GetStaticMethodID(PEnv,(PEnv^^).GetObjectClass(PEnv,Obj),(PEnv^^).GetStringUTFChars(PEnv,
aproc, nil),'()V') ;
end;
And here Java code :
public class fpg {
public native void register();
public void callback() {
writeln("Ýep it works");
}
public static native void buttononclick(int i, int j, String t);
public static void main(String[] args) {
System.loadLibrary("fpg");
formonclick("callback");
}
}
fpc Library and java app compiles but when running the java app i get that error :
>Exception in thread "main" java.lang.NoSuchMethodError: callback1
> at fpg.formonclick(Native Method) at fpg.main(fpg.java:34)
What is wrong ? => I do not understand because callback is declared in main java thread..
Any help would be extremely appreciated.
Many thanks.
Fred.
-----
Many thanks ;-)