Restriction: This applies to native code only.
The Java wrapper class must extend either
microfocus.cobol.RuntimeObject or
microfocus.cobol.RuntimeSystem. This affects the lifetime of the
native OO COBOL instances represented by instances of the Java wrapper class:
- When the wrapper inherits from
microfocus.cobol.RuntimeObject, if a wrapper object is destroyed by the Java garbage collector, the corresponding native OO COBOL instance is finalized.
- When the wrapper inherits from
microfocus.cobol.RuntimeSystem, the native OO COBOL instance is finalized whenever execution exits from a method, losing any instance data.
The wrapper class needs to be initialized with the library and filename of the COBOL class it is wrapping. You do this by
including the following code inside the Java wrapper class:
static
{
cobloadclass("libname","filename","fullJavaClassName");
}
where:
-
libname
- s the name of the
.dll file which contains the native OO COBOL class. You can leave this parameter as null if the class is not packaged inside a
.dll file
- for example, if it is running as
.int or
.gnt code.
-
filename
- is the filename of the native OO COBOL class.
-
FullJavaClassName
- is the Java classname corresponding to the native OO COBOL class.
There are three cobloadclass() methods, which provide slightly different ways of identifying the library, COBOL file and the
Java wrapper class.