Bug 1479 - NativeLibrary: Add getNativeLibraryPath() returning actual native library path, support throughout DynamicLibraryBundle[Info]
Summary: NativeLibrary: Add getNativeLibraryPath() returning actual native library pat...
Alias: None
Product: Gluegen
Classification: JogAmp
Component: core (show other bugs)
Version: 2.6.0
Hardware: All all
: P4 enhancement
Assignee: Sven Gothel
Depends on:
Reported: 2023-11-26 09:46 CET by Sven Gothel
Modified: 2023-11-26 10:02 CET (History)
0 users

See Also:
SCM Refs:
gluegen c7efca6d9b0db7305f5352ebf15d915ae5a1fa24 joal 316e80eaa678c9bf1b03685c081d48d2cf927f43 jogl 736b717b5d6d2b2e7ac4066f54495e8e111d0e01 jocl 4bf432acdac37f570226affc2a341a61a1b6d16a
Workaround: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2023-11-26 09:46:12 CET
Motivation: It is helpful to retrieve the actually used native library pathname,
since loading a library w/o absolute path but lookup through LD_LIBRARY_PATH
may render it hard for the user to determine which library is used.


Windows implementation simply can use GetModuleFileNameA() with the native library handle.

POSIX implementation may utilize a symbol-name to retrieve its address within the 
loading native library used to retrieved the library information 
via dladdr().

To support this feature throughout DynamicLibraryBundle and DynamicLibraryBundleInfo,
the custom DynamicLibraryBundleInfo specializations shall provide  
optional symbol-names per each tool-library-name for the POSIX implementation,
see above.

public interface DynamicLibraryBundleInfo {


 * Returns optional list of optional symbol names per {@link #getToolLibNames()} 
 * in same order for an OS which requires the symbol's address to retrieve 
 * the path of the containing library.
public List<String> getSymbolForToolLibPath();


Comment 1 Sven Gothel 2023-11-26 10:02:36 CET
Resolved as described, implemented in GlueGen and adopted in joal, jogl and jocl