def jvm_load(prefer=None):
"""
Loads the JVM dynamic library. The `prefer` argument works like for `jvm_find`. If the library
is already loaded, this produces a warning if `prefer` doesn't match the loaded library,
otherwise it does nothing.
"""
global libjvm, libjvm_type
if libjvm is not None:
if prefer is not None and prefer != libjvm_type:
import warnings
warnings.warn('Already loaded JVM "%s", so preferred JVM "%s" is unloadable'%(libjvm_type,prefer))
return
jvm,libjvm_type = jvm_find(prefer)
libjvm = (ctypes.windll if is_win else ctypes.cdll).LoadLibrary(jvm)
评论列表
文章目录