Bug 1479

Summary: NativeLibrary: Add getNativeLibraryPath() returning actual native library path, support throughout DynamicLibraryBundle[Info]
Product: [JogAmp] Gluegen Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P4    
Version: 2.6.0   
Hardware: All   
OS: all   
Type: FEATURE SCM Refs:
gluegen c7efca6d9b0db7305f5352ebf15d915ae5a1fa24 joal 316e80eaa678c9bf1b03685c081d48d2cf927f43 jogl 736b717b5d6d2b2e7ac4066f54495e8e111d0e01 jocl 4bf432acdac37f570226affc2a341a61a1b6d16a
Workaround: ---

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