Skip to content

Commit

Permalink
Added updates to ChangeLog and a description to .texi file
Browse files Browse the repository at this point in the history
  • Loading branch information
xevor11 committed Aug 23, 2024
1 parent b7b8b42 commit 1493f2f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
40 changes: 40 additions & 0 deletions doc/gnucobol.texi
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,7 @@ For a complete list of supported system routines,
* CBL_GC_NANOSLEEP:: Sleep for nanoseconds
* CBL_GC_FORK:: Fork the current COBOL process to a new one
* CBL_GC_WAITPID:: Wait for a system process to end
* Java Integration:: Interfacing with Java through JNI
@end menu

@node CBL_GC_GETOPT
Expand Down Expand Up @@ -2575,6 +2576,45 @@ is not available on the current system.
END-DISPLAY
@end example

@node Java Integration
@section Java Integration
@cindex Java, JNI, method calls

GnuCOBOL now supports integration with Java through the Java Native Interface (JNI). This allows COBOL programs to call Java methods directly.

@subsection Supported Method Calls
Currently, only void Java methods with no parameters are supported. Method calls that do not conform to this restriction will result in an error at compile-time.

@subsection Setting Up Java Integration
To use Java integration, you need to set the `JAVA_HOME` environment variable to point to your Java installation. Additionally, ensure that your `PATH` includes the Java binaries.

@subsection Error Handling
Any attempt to call Java methods with parameters or expecting return values will result in a compile-time error. The GnuCOBOL compiler will issue a warning if the method name does not follow the `Java.ClassName.methodName` format.

@subsection Known Limitations
Currently, GnuCOBOL supports only void methods without parameters. Future updates will address these limitations to provide broader Java integration capabilities.

@subsection Example Usage
Here is an example of a COBOL program calling a Java method:

@example
IDENTIFICATION DIVISION.
PROGRAM-ID. SampleJavaCall.
PROCEDURE DIVISION.
CALL "Java.com.example.HelloWorld.printMessage".
STOP RUN.
@end example

Ensure the class `com.example.HelloWorld` is in your classpath and that `printMessage` is a static void method with no parameters.

@subsection Environment Variables
Set the following environment variables to enable Java integration:

@example
export JAVA_HOME=/path/to/java
export PATH=$JAVA_HOME/bin:$PATH
@end example

@node Appendices

@menu
Expand Down
11 changes: 8 additions & 3 deletions libcob/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@

2024-08-22 Vedant Tewari <[email protected]>
* cobc/codegen.c Added error handling to restrict Java method calls to void methods without parameters or return values
* cobc/parser.y Implemented detection of malformed Java method names during parsing. Added checks for unsupported method calls with parameters or return values
* java.c Enhanced error handling with `cob_runtime_error` for missing classes

2024-08-14 Nicolas Berthier <[email protected]>

* common.c (print_info_detailed): added note for Java interoperability

2024-06-12 Vedant Tewari <[email protected]>

* Makefile.am: Updated to include JNI-related files
* common.h: Added internal state for JNI support
* java.c: Implemented JNI support for GnuCOBOL
* Makefile.am Updated to include JNI-related files
* common.h Added internal state for JNI support
* java.c Implemented JNI support for GnuCOBOL

2024-08-04 David Declerck <[email protected]>

Expand Down

0 comments on commit 1493f2f

Please sign in to comment.