This feature enhances Bug 1510 further. +++ NativeLibrary shall allow adding (user) search path to the OS linker facility where supported (Windows). For this feature, we require to have more information for the `DynamicLinker` implementation, i.e. the new `NativeLibrary.LibPath` exposing - whether its an absolute path, - contained directory shall be added to search path (first) and - otherwise potential added search path to prepend. This feature is currently only supported by the Windows native linker, since the POSIX `dlopen` facility doesn't allow to modify `LD_LIBRARY_PATH` at runtime. +++ Add Java property `jogamp.primary.library.path` containing a separated path in the OS system's format. These paths will be searched first, allowing to inject custom native libraries at runtime. +++ NativeLibrary's search order is not clear, or has a bug in regards to `searchSystemPathFirst`. Here the system and user lib-path is not well separated. Clarified search order: * ## System Search Resolution * System search's behavior depends on `searchOSSystemPath` and `searchSystemPathFirst`. * * ### OS System Search * - System search path direct lookup (absolute path) * - Windows: `PATH` * - MacOS: `DYLD_LIBRARY_PATH` * - Unix: `LD_LIBRARY_PATH` * - System search path implicit lookup (relative path) * - OSX System search path direct lookup (absolute path) * - `/Library/Frameworks/` * - `/System/Library/Frameworks/` * * ### System Search * - if `searchSystemPathFirst` * - If `searchOSSystemPath` * - Perform described `OS System Search` above * - Java's ClassLoader `findLibrary` mechanism * - Java's Java system library path property * - `sun.boot.library.path` * - if `!searchSystemPathFirst` * - Java's Java system library path property * - `sun.boot.library.path` * - Java's ClassLoader `findLibrary` mechanism * - If `searchOSSystemPath` * - Perform described `OS System Search` above * * ## Native Library Search Resolution * - Absolute path only, if given * - JogAmp's optional primary search path from Java property `jogamp.primary.library.path` * - path is separated via `File.pathseparator` * - if `searchSystemPathFirst` * - Perform described `System Search Resolution` above * - Java's Java user library path property * - `java.library.path` * - Java's Java user current working directory * - user: `user.dir` * - user+fat: `user.dir` + File.separator + `natives` + File.separator + `PlatformPropsImpl.os_and_arch` * - if `!searchSystemPathFirst` * - Perform described `System Search Resolution` above
Resolved as described in commit 581549571c0a0bd245621a004cc2a9be6d10888b
commit f051db16085b615e8609b889817d43209ebd1ebf Bug 1519 - NativeLibrary: `searchPathPrepend` shall act independent of `addToSearchPath`, do a null-check when using (Windows) Current usage sets both, i.e. addToSearchPath=true and searchPathPrepend=<some-valid-path>. However, it shall be used independent offering more flexibility and fail-proof.
Produced javadoc: https://jogamp.org/deployment/jogamp-next/javadoc/gluegen/javadoc/classcom_1_1jogamp_1_1common_1_1os_1_1NativeLibrary.html#details