public abstract class NativeLibResolver extends Object
java.library.path for the lib. If the lib is not found it will
be searched in the resources of the Consumers class. The search directoy is
/lib/. If its found it will be copied to the temp dir and can be loaded with
the class loader that actually needs the lib. This makes sure that OSGi can
find, load and use the native lib, because each bundle has its own
classloder. So a lib loded from this bundle cant be used in the Consumers
bundle. This is needed because System.load(absoluteLibName) uses
refecti9ons to find the correct classloder which is the one that System.load
is called.| Modifier and Type | Field and Description |
|---|---|
protected static Logger |
LOG |
protected static Set<MultiarchInfo> |
MULTIARCH_INFO |
protected static MultiarchTupelBuilder |
MULTIARCH_TUPEL_BUILDER |
protected static File |
NATIVE_TEMP_DIR |
protected static OS |
RUNNING_ON_OS |
| Modifier and Type | Method and Description |
|---|---|
static OS |
getOS() |
static LoadResult |
loadClassicalNativeLib(String libName,
Consumer<String> consumer) |
static LoadResult |
loadNativeLib(String libName,
int libToolInterfaceVersion,
Consumer<String> consumer)
Only call System.load(absLibName); in the subclass - so OSGi can pick the
right classloader...
|
protected static final Logger LOG
protected static final MultiarchTupelBuilder MULTIARCH_TUPEL_BUILDER
protected static final Set<MultiarchInfo> MULTIARCH_INFO
protected static final OS RUNNING_ON_OS
protected static final File NATIVE_TEMP_DIR
public static LoadResult loadNativeLib(String libName, int libToolInterfaceVersion, Consumer<String> consumer)
libName - the name of the lib without any pre or
posfix. @see OS for the naming templates.libToolInterfaceVersion - the libtool version.consumer - the consumer which really load the lib.public static LoadResult loadClassicalNativeLib(String libName, Consumer<String> consumer)
public static OS getOS()
Copyright © 2019. All rights reserved.