Return the host Java virtual machine in a dynamic library loaded by Java.
lw-ji
get-host-java-virtual-machine => jvm
jvm⇩ |
A java-vm-poi or nil . |
The function get-host-java-virtual-machine
returns the host Java virtual machine when it is called in a dynamic library that was delivered with a call setup-deliver-dynamic-library-for-java, and the dynamic library was loaded by Java. In all other circumstances it returns nil
.
If the initialization of the Java interface is synchronous, which is determined the asynchronous argument of setup-deliver-dynamic-library-for-java and is the default, then during the call to the deliver startup function (the first argument ot deliver), get-host-java-virtual-machine
still returns nil
. It is guaranteed to return the correct value only when the function argument of setup-deliver-dynamic-library-for-java (if any) is called. In the asynchronous case, get-host-java-virtual-machine
always returns the correct value.
The result jvm, when it is not nil
, is an object of type java-vm-poi.
get-host-java-virtual-machine
is useful as a predicate to determine if the library was loaded by Java or non-Java code.
get-host-java-virtual-machine
can find the virtual machine because Java calls JNI_OnLoad
with it. If a non-Java code calls JNI_OnLoad
with something else, then get-host-java-virtual-machine
will return that something else.
When init-java-interface is called without a specified Java virtual machine, it uses get-host-java-virtual-machine
to try to find the current one.
setup-deliver-dynamic-library-for-java
init-java-interface
15 Java interface
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:46