Interface Library
- All Known Subinterfaces:
- Advapi32,- Carbon,- Cfgmgr32,- CoreDLL,- CoreFoundation,- Crypt32,- Cryptui,- Ddeml,- DiskArbitration,- Dxva2,- GDI32,- IOKit,- IPHlpAPI,- Kernel32,- Kstat2,- LibC,- LibC,- LibKstat,- LibRT,- MacFileUtils.FileManager,- Mpr,- Msi,- Netapi32,- NtDll,- Ole32,- OleAuto,- OpenGL32,- Pdh,- Perfstat,- PowrProf,- Psapi,- Rasapi32,- Secur32,- SetupApi,- Shell32,- ShellAPI,- Shlwapi,- StdCallLibrary,- SystemB,- Udev,- User32,- Version,- W32APIOptions,- Wevtapi,- Wininet,- Winsock2,- Winspool,- Wtsapi32,- X11,- X11.Xevie,- X11.Xext,- X11.Xrender,- X11.XTest,- XAttr,- XAttr
- All Known Implementing Classes:
- AccCtrl
 MyNativeLibrary INSTANCE = (MyNativeLibrary)
     Native.load("mylib", MyNativeLibrary.class);
 
 By convention, method names are identical to the native names, although you
 can map java names to different native names by providing a
 FunctionMapper as a value for key OPTION_FUNCTION_MAPPER
 in the options map passed to the
 Native.load(String, Class, Map) call.
 
Although the names for structures and structure fields may be chosen arbitrarily, they should correspond as closely as possible to the native definitions. The same is true for parameter names.
 This interface supports multiple, concurrent invocations of any library
 methods on the Java side.  Check your library documentation for its
 multi-threading requirements on the native side.  If a library is not safe
 for simultaneous multi-threaded access, consider using
 Native.synchronizedLibrary(com.sun.jna.Library) to prevent simultaneous multi-threaded
 access to the native code.
 
 Optional fields
 Interface options will be automatically propagated to structures defined
 within the library provided a call to
 Native.load(String,Class,Map) is made prior to instantiating
 any of those structures.  One common way of ensuring this is to declare
 an INSTANCE field in the interface which holds the
 load result.
 
 OPTIONS (an instance of Map),
 TYPE_MAPPER (an instance of TypeMapper),
 STRUCTURE_ALIGNMENT (one of the alignment types defined in
 Structure), and STRING_ENCODING (a String) may also
 be defined.  If no instance of the interface has been instantiated, these
 fields will be used to determine customization settings for structures and
 methods defined within the interface.
 
- Author:
- Todd Fast, todd.fast@sun.com, Timothy Wall, twalljava@dev.java.net
- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringOption key for a boolean flag to allow any Java class instance as a parameter.static final StringCalling convention for the entire library.static final StringClass loader to use when searching for native libraries on the resource path (classpath).static final StringOption key for aFunctionMapperfor the library.static final StringOption key for anInvocationMapperfor the library.static final StringFlags to use when opening the native library (seeNative.open(String,int))static final StringOption key for per-library String encoding.static final Stringstatic final StringSupports a custom symbol provider for the NativeLibrary (seeSymbolProvider)static final StringOption key for aTypeMapperfor the library.
- 
Field Details- 
OPTION_TYPE_MAPPEROption key for aTypeMapperfor the library.- See Also:
 
- 
OPTION_FUNCTION_MAPPEROption key for aFunctionMapperfor the library.- See Also:
 
- 
OPTION_INVOCATION_MAPPEROption key for anInvocationMapperfor the library.- See Also:
 
- 
OPTION_STRUCTURE_ALIGNMENTOption key for structure alignment type (Integer), which should be one of the predefined alignment types inStructure.- See Also:
 
- 
OPTION_STRING_ENCODINGOption key for per-library String encoding. This affects conversions between Java unicode and native ( Defaults toconst char*) strings (as arguments or Structure fields).Native.getDefaultStringEncoding().- See Also:
 
- 
OPTION_ALLOW_OBJECTSOption key for a boolean flag to allow any Java class instance as a parameter. If no type mapper is found, the object is passed as a pointer. NOTE: This is for use with raw JNI interactions via the JNIEnv data structure.- See Also:
 
- 
OPTION_CALLING_CONVENTIONCalling convention for the entire library.- See Also:
 
- 
OPTION_OPEN_FLAGSFlags to use when opening the native library (seeNative.open(String,int))- See Also:
 
- 
OPTION_CLASSLOADERClass loader to use when searching for native libraries on the resource path (classpath). If not provided the current thread's context class loader is used. If extracted from the resource path (i.e. bundled in a jar file), the loaded library's lifespan will mirror that of the class loader, which means you can use the same library in isolated contexts without conflict.- See Also:
 
- 
OPTION_SYMBOL_PROVIDERSupports a custom symbol provider for the NativeLibrary (seeSymbolProvider)- See Also:
 
 
-