OCamlPro / gnucobol

A clone of the sourceforge GnuCOBOL compiler from COBOL to C.
https://get-superbol.com
GNU Lesser General Public License v3.0
16 stars 20 forks source link

Initial JNI configuration #157

Open xevor11 opened 3 weeks ago

xevor11 commented 3 weeks ago

Cleaned up java.c, added the requested changes from PR#150, ready for feedback and comments

GitMensch commented 3 weeks ago

I hope my commit to java.c did not break anything... (I just felt that the explanations would take much longer and those are more related to libcob in general than the changes of this project itself). ... if not: thank you for cleaning it up.

And yes, once there is a running simple test, we should update the branch from gcos4 which will then also include the CI. for further commits.

xevor11 commented 3 weeks ago

I hope my commit to java.c did not break anything... (I just felt that the explanations would take much longer and those are more related to libcob in general than the changes of this project itself). ... if not: thank you for cleaning it up.

And yes, once there is a running simple test, we should update the branch from gcos4 which will then also include the CI. for further commits.

image

Update: Fixed warnings

xevor11 commented 6 days ago

Addressing this specific system call:

System.getProperty("java.version")

I wrote a simple method call:

if ((cob_global_exception & 0x0b00) == 0x0b00) cob_global_exception = 0;
    if (call_java_class_method_call.funcvoid == NULL || cob_glob_ptr->cob_physical_cancel)
  {
    call_java_class_method_call.funcvoid = cob_resolve_cobol ("java_class_method_call", 0, 0);
  }

however internally it must be create the VM and retrieve the methods from the JNI Function Table?

GitMensch commented 6 days ago

however internally it must be create the VM and retrieve the methods from the JNI Function Table?

Yes the first fist to be done in java.c once and the other is done by the cob_resolve_java (which will also set the exception and possible internal registers if resolving it does not work).