Re: [fpc-pascal] Type helper for JNI pointers

2018-08-26 Thread Benito van der Zander
Hi, I haven't used type helpers but why not change to defines like type   jObjectRec = record end;   jObject= ^jObjectRec;   jClassRec = record end;   jClass = ^jClassRec; or possibly simpler you could try   jclass = type(jobject); // I believe this forces a new type and is not just an

Re: [fpc-pascal] Type helper for JNI pointers

2018-08-22 Thread Andrew Haines via fpc-pascal
On 08/12/2018 07:42 AM, Benito van der Zander wrote: But this does not work, because fpc thinks jclass and jobject are the same type, so there is only one type helper for both of the types allowed. Because it is declared as type jobject=pointer; jclass=jobject; What can we do

[fpc-pascal] Type helper for JNI pointers

2018-08-12 Thread Benito van der Zander
Hi, when you use JNI functions you always need to repeat "env" a lot: var   javaClass: jclass;   javaObj: jobject; begin   //javaClass := ...   javaObj := env^^.NewObject(env, javaClass)   env^^.DeleteLocalRef(env, javaObj); end; So I thought you could declare type helpers for jobject and