diff options
author | Sven Gothel <[email protected]> | 2011-08-09 20:56:27 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-08-09 20:56:27 +0200 |
commit | 90ff6c401934121395fa4a127e8b889106fda07a (patch) | |
tree | 5e9d5161320e7f507e10f77cf256a8e6e425c0b5 /src/java/com/jogamp/common/os | |
parent | ae6b6a4ebec87be9a9dfb4df2eecb7c4e21dd37d (diff) |
DynamicLibraryBundleInfo: Allow impl. to select tool/system lookup
Diffstat (limited to 'src/java/com/jogamp/common/os')
-rwxr-xr-x | src/java/com/jogamp/common/os/DynamicLibraryBundle.java | 26 | ||||
-rw-r--r-- | src/java/com/jogamp/common/os/DynamicLibraryBundleInfo.java | 16 |
2 files changed, 34 insertions, 8 deletions
diff --git a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java index 7e961cc..8e072fd 100755 --- a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java +++ b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java @@ -306,6 +306,19 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { return addr; } + private long toolDynamicLookupFunction(String funcName) { + if(0 != toolGetProcAddressHandle) { + long addr = info.toolGetProcAddress(toolGetProcAddressHandle, funcName); + if(DEBUG_LOOKUP) { + if(0!=addr) { + System.err.println("Lookup-Tool: <"+funcName+"> 0x"+Long.toHexString(addr)); + } + } + return addr; + } + return 0; + } + public long dynamicLookupFunction(String funcName) { if(!isToolLibLoaded() || null==funcName) { if(DEBUG_LOOKUP && !isToolLibLoaded()) { @@ -319,18 +332,17 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { } long addr = 0; + final boolean useToolGetProcAdressFirst = info.useToolGetProcAdressFirst(funcName); - if(0 != toolGetProcAddressHandle) { - addr = info.toolDynamicLookupFunction(toolGetProcAddressHandle, funcName); - if(DEBUG_LOOKUP) { - if(0!=addr) { - System.err.println("Lookup-Tool: <"+funcName+"> 0x"+Long.toHexString(addr)); - } - } + if(useToolGetProcAdressFirst) { + addr = toolDynamicLookupFunction(funcName); } if(0==addr) { addr = dynamicLookupFunctionOnLibs(funcName); } + if(0==addr && !useToolGetProcAdressFirst) { + addr = toolDynamicLookupFunction(funcName); + } return addr; } diff --git a/src/java/com/jogamp/common/os/DynamicLibraryBundleInfo.java b/src/java/com/jogamp/common/os/DynamicLibraryBundleInfo.java index 61f59b8..081bac8 100644 --- a/src/java/com/jogamp/common/os/DynamicLibraryBundleInfo.java +++ b/src/java/com/jogamp/common/os/DynamicLibraryBundleInfo.java @@ -56,13 +56,27 @@ public interface DynamicLibraryBundleInfo { /** May return the native libraries <pre>GetProcAddressFunc</pre> names, the first found function is being used.<br> * This could be eg: <pre> glXGetProcAddressARB, glXGetProcAddressARB </pre>.<br> * If your Tool does not has this facility, just return null. + * @see #toolGetProcAddress(long, String) */ public List getToolGetProcAddressFuncNameList() ; /** May implement the lookup function using the Tools facility.<br> + * The actual function pointer is provided to allow proper bootstrapping of the ProcAddressTable, + * using one of the provided function names by {@link #getToolGetProcAddressFuncNameList()}.<br> + */ + public long toolGetProcAddress(long toolGetProcAddressHandle, String funcName); + + /** May implement the lookup function using the Tools facility.<br> * The actual function pointer is provided to allow proper bootstrapping of the ProcAddressTable.<br> */ - public long toolDynamicLookupFunction(long toolGetProcAddressHandle, String funcName); + + /** + * @param funcName + * @return true if {@link #toolGetProcAddress(long, String)} shall be tried before + * the system loader for the given function lookup. Otherwise false. + * Default is <b>true</b>. + */ + public boolean useToolGetProcAdressFirst(String funcName); /** @return true if the native library symbols shall be made available for symbol resolution of subsequently loaded libraries. */ public boolean shallLinkGlobal(); |