File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -113,6 +113,8 @@ public interface Library {
113113 * conflict.
114114 */
115115 String OPTION_CLASSLOADER = "classloader" ;
116+ /** Provides a custom symbol resolver. */
117+ String OPTION_SYMBOL_RESOLVER = "symbol-resolver" ;
116118
117119 static class Handler implements InvocationHandler {
118120
Original file line number Diff line number Diff line change @@ -630,7 +630,12 @@ long getSymbolAddress(String name) {
630630 if (handle == 0 ) {
631631 throw new UnsatisfiedLinkError ("Library has been unloaded" );
632632 }
633- return Native .findSymbol (handle , name );
633+ final SymbolResolver resolver = (SymbolResolver )options .get (Library .OPTION_SYMBOL_RESOLVER );
634+ if (resolver != null ) {
635+ return resolver .getSymbolAddress (this , name );
636+ } else {
637+ return Native .findSymbol (handle , name );
638+ }
634639 }
635640
636641 @ Override
Original file line number Diff line number Diff line change 1+ package com .sun .jna ;
2+
3+ public interface SymbolResolver {
4+ long getSymbolAddress (NativeLibrary library , String symbolName );
5+ }
You can’t perform that action at this time.
0 commit comments