Skip to content

Commit d42375c

Browse files
Merge pull request #970 from matthiasblaesing/restore-compatibilty-loadLibrary
Restore compatibility of Native#loadLibrary, deprecate for Native#load
2 parents 324de41 + 00d6b13 commit d42375c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+184
-138
lines changed

CHANGES.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Features
99
--------
1010
* [#915](https://github.com/java-native-access/jna/pull/915): Adding interfaces to call to Cryptui and Crypt32 windows libraries and adding related structures to Wincrypt. - [@rosh89](https://github.com/rosh89).
1111
* [#903](https://github.com/java-native-access/jna/pull/903): Carry `HRESULT` in `c.s.j.p.win32.COM.COMException`, introduce `c.s.j.p.win32.COM.COMInvokeException` as subclass of `COMException` for exception as the result of a `IDispatch#Invoke`. The `EXECPINFO` is unwrapped into fields in the `COMInvokeException` and correctly freed. - [@matthiasblaesing](https://github.com/matthiasblaesing).
12-
* [#822](https://github.com/java-native-access/jna/issues/822): `Native#loadLibrary` requires that the interface class passed in is an instance of Library. The runtime check can be enhanced by using a constraint generic. This breaks binary compatibility (see notes below) - [@d-noll](https://github.com/d-noll).
12+
* [#822](https://github.com/java-native-access/jna/issues/822): `Native#loadLibrary` requires that the interface class passed in is an instance of Library. The runtime check can be enhanced by using a constraint generic. This breaks binary compatibility (see notes below) - [@d-noll](https://github.com/d-noll).<br /><br />In a followup, the original `loadLibrary` methods were deprecated and `Native#load` methods were introduced, that hold the new generic definitions. So this change is now binary compatible.
1313
* [#889](https://github.com/java-native-access/jna/issues/889): The `Structure#newInstance` receive the target type as a parameter. This adds a limited generic type, so that the return type ist the target type and not a generic structure, removing the necessity to do an explizit cast - [@matthiasblaesing](https://github.com/matthiasblaesing).
1414
* [#913](https://github.com/java-native-access/jna/issues/913): Add `@ComInterface` annotation to `com.sun.jna.platform.win32.COM.util.IConnectionPoint` to make it possible to retrieve it via `IUnknown#queryInterface` - [@matthiasblaesing](https://github.com/matthiasblaesing).
1515
* [#797](https://github.com/java-native-access/jna/issues/797): Binding `Advapi32#EnumDependendServices`, `Advapi32#EnumServicesStatusEx` and `Advapi32#QueryServiceStatus`. `W32Service#stopService` was modified to be more resilent when stopping service - [@matthiasblaesing](https://github.com/matthiasblaesing).
@@ -66,10 +66,6 @@ Breaking Changes
6666
* `com.sun.jna.Native#setPreserveLastError` and `com.sun.jna.Native#getPreserveLastError`
6767
were removed without replacement. They were turned into NOOPs in the past.
6868
* `com.sun.jna.Native#getDirectByteBuffer` was replaced by `com.sun.jna.Pointer#getByteBuffer`
69-
* `com.sun.jna.Native#loadLibrary` methods return a `T` instance and expect
70-
a `Class<T>` as parameter. `T` was unconstraint and was modified to
71-
extend `com.sun.jna.Library`. This change is source compatible, but not
72-
binary compatbile, so bindings need to be recompiled.
7369
* the parameters of the methods `gethostname`, `sethostname`, `getdomainname`
7470
and `setdomainname` in the interface `com.sun.jna.platform.unix.LibCAPI`
7571
were changed from `(char[] name, int len)` to `(byte[] name, int len)`

contrib/platform/src/com/sun/jna/platform/mac/Carbon.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* Date: 7/25/11
4242
*/
4343
public interface Carbon extends Library {
44-
Carbon INSTANCE = Native.loadLibrary("Carbon", Carbon.class);
44+
Carbon INSTANCE = Native.load("Carbon", Carbon.class);
4545

4646
int cmdKey = 0x0100;
4747
int shiftKey = 0x0200;

contrib/platform/src/com/sun/jna/platform/mac/MacFileUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class MacFileUtils extends FileUtils {
4242

4343
public interface FileManager extends Library {
4444

45-
FileManager INSTANCE = Native.loadLibrary("CoreServices", FileManager.class);
45+
FileManager INSTANCE = Native.load("CoreServices", FileManager.class);
4646

4747
int kFSFileOperationDefaultOptions = 0;
4848
int kFSFileOperationsOverwrite = 0x01;

contrib/platform/src/com/sun/jna/platform/mac/SystemB.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
*/
4141
public interface SystemB extends Library {
4242

43-
SystemB INSTANCE = Native.loadLibrary("System", SystemB.class);
43+
SystemB INSTANCE = Native.load("System", SystemB.class);
4444

4545
// host_statistics()
4646
int HOST_LOAD_INFO = 1;// System loading stats

contrib/platform/src/com/sun/jna/platform/mac/XAttr.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
interface XAttr extends Library {
3535

3636
// load from current image
37-
XAttr INSTANCE = Native.loadLibrary(null, XAttr.class);
37+
XAttr INSTANCE = Native.load(null, XAttr.class);
3838

3939
// see /usr/include/sys/xattr.h
4040
int XATTR_NOFOLLOW = 0x0001;

contrib/platform/src/com/sun/jna/platform/unix/LibC.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
*/
3333
public interface LibC extends LibCAPI, Library {
3434
String NAME = "c";
35-
LibC INSTANCE = Native.loadLibrary(NAME, LibC.class);
35+
LibC INSTANCE = Native.load(NAME, LibC.class);
3636
}

contrib/platform/src/com/sun/jna/platform/unix/X11.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ class XImage extends PointerType { }
289289

290290
/** Definition (incomplete) of the Xext library. */
291291
interface Xext extends Library {
292-
Xext INSTANCE = Native.loadLibrary("Xext", Xext.class);
292+
Xext INSTANCE = Native.load("Xext", Xext.class);
293293
// Shape Kinds
294294
int ShapeBounding = 0;
295295
int ShapeClip = 1;
@@ -307,7 +307,7 @@ void XShapeCombineMask(Display display, Window window, int dest_kind,
307307

308308
/** Definition (incomplete) of the Xrender library. */
309309
interface Xrender extends Library {
310-
Xrender INSTANCE = Native.loadLibrary("Xrender", Xrender.class);
310+
Xrender INSTANCE = Native.load("Xrender", Xrender.class);
311311

312312
@FieldOrder({"red", "redMask", "green", "greenMask", "blue", "blueMask", "alpha", "alphaMask"})
313313
class XRenderDirectFormat extends Structure {
@@ -346,7 +346,7 @@ class XRenderPictFormat extends Structure {
346346
/** Definition of the Xevie library. */
347347
interface Xevie extends Library {
348348
/** Instance of Xevie. Note: This extension has been removed from xorg/xserver on Oct 22, 2008 because it is broken and maintainerless. */
349-
Xevie INSTANCE = Native.loadLibrary("Xevie", Xevie.class);
349+
Xevie INSTANCE = Native.load("Xevie", Xevie.class);
350350
int XEVIE_UNMODIFIED = 0;
351351
int XEVIE_MODIFIED = 1;
352352
// Bool XevieQueryVersion (Display* display, int* major_version, int* minor_version);
@@ -363,7 +363,7 @@ interface Xevie extends Library {
363363

364364
/** Definition of the XTest library. */
365365
interface XTest extends Library {
366-
XTest INSTANCE = Native.loadLibrary("Xtst", XTest.class);///usr/lib/libxcb-xtest.so.0
366+
XTest INSTANCE = Native.load("Xtst", XTest.class);///usr/lib/libxcb-xtest.so.0
367367
boolean XTestQueryExtension(Display display, IntByReference event_basep, IntByReference error_basep, IntByReference majorp, IntByReference minorp);
368368
boolean XTestCompareCursorWithWindow(Display display, Window window, Cursor cursor);
369369
boolean XTestCompareCurrentCursorWithWindow(Display display, Window window);
@@ -395,7 +395,7 @@ class XDeviceByReference extends Structure implements Structure.ByReference {
395395
public XInputClassInfoByReference classes;
396396
}
397397

398-
X11 INSTANCE = Native.loadLibrary("X11", X11.class);
398+
X11 INSTANCE = Native.load("X11", X11.class);
399399

400400
/*
401401
typedef struct {

contrib/platform/src/com/sun/jna/platform/unix/solaris/LibKstat.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
*/
4242
public interface LibKstat extends Library {
4343

44-
LibKstat INSTANCE = Native.loadLibrary("kstat", LibKstat.class);
44+
LibKstat INSTANCE = Native.load("kstat", LibKstat.class);
4545

4646
/*
4747
* Kstat Data Types

contrib/platform/src/com/sun/jna/platform/win32/Advapi32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
* @author dblock[at]dblock.org
6868
*/
6969
public interface Advapi32 extends StdCallLibrary {
70-
Advapi32 INSTANCE = Native.loadLibrary("Advapi32", Advapi32.class, W32APIOptions.DEFAULT_OPTIONS);
70+
Advapi32 INSTANCE = Native.load("Advapi32", Advapi32.class, W32APIOptions.DEFAULT_OPTIONS);
7171

7272
int MAX_KEY_LENGTH = 255;
7373
int MAX_VALUE_NAME = 16383;

contrib/platform/src/com/sun/jna/platform/win32/Crypt32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
*/
4242
public interface Crypt32 extends StdCallLibrary {
4343

44-
Crypt32 INSTANCE = Native.loadLibrary("Crypt32", Crypt32.class, W32APIOptions.DEFAULT_OPTIONS);
44+
Crypt32 INSTANCE = Native.load("Crypt32", Crypt32.class, W32APIOptions.DEFAULT_OPTIONS);
4545

4646
/**
4747
* The CryptProtectData function performs encryption on the data in a DATA_BLOB

contrib/platform/src/com/sun/jna/platform/win32/Cryptui.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838
public interface Cryptui extends StdCallLibrary {
3939

40-
Cryptui INSTANCE = (Cryptui) Native.loadLibrary("Cryptui", Cryptui.class, W32APIOptions.UNICODE_OPTIONS);
40+
Cryptui INSTANCE = (Cryptui) Native.load("Cryptui", Cryptui.class, W32APIOptions.UNICODE_OPTIONS);
4141

4242
/**
4343
* The CryptUIDlgSelectCertificateFromStore function displays a dialog box that

contrib/platform/src/com/sun/jna/platform/win32/Ddeml.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
*/
5656
public interface Ddeml extends StdCallLibrary {
5757

58-
Ddeml INSTANCE = Native.loadLibrary("user32", Ddeml.class, W32APIOptions.DEFAULT_OPTIONS);
58+
Ddeml INSTANCE = Native.load("user32", Ddeml.class, W32APIOptions.DEFAULT_OPTIONS);
5959

6060
public class HCONVLIST extends PointerType {
6161
};

contrib/platform/src/com/sun/jna/platform/win32/Dxva2.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public interface Dxva2 extends StdCallLibrary, PhysicalMonitorEnumerationAPI, Hi
6666
/**
6767
* The only instance of the library
6868
*/
69-
Dxva2 INSTANCE = Native.loadLibrary("Dxva2", Dxva2.class, DXVA_OPTIONS);
69+
Dxva2 INSTANCE = Native.load("Dxva2", Dxva2.class, DXVA_OPTIONS);
7070

7171

7272
/******************************************************************************

contrib/platform/src/com/sun/jna/platform/win32/GDI32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
*/
5151
public interface GDI32 extends StdCallLibrary {
5252

53-
GDI32 INSTANCE = Native.loadLibrary("gdi32", GDI32.class, W32APIOptions.DEFAULT_OPTIONS);
53+
GDI32 INSTANCE = Native.load("gdi32", GDI32.class, W32APIOptions.DEFAULT_OPTIONS);
5454

5555
/**
5656
* Used with BitBlt. Copies the source rectangle directly to the destination

contrib/platform/src/com/sun/jna/platform/win32/Kernel32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
public interface Kernel32 extends StdCallLibrary, WinNT, Wincon {
4040

4141
/** The instance. */
42-
Kernel32 INSTANCE = Native.loadLibrary("kernel32", Kernel32.class, W32APIOptions.DEFAULT_OPTIONS);
42+
Kernel32 INSTANCE = Native.load("kernel32", Kernel32.class, W32APIOptions.DEFAULT_OPTIONS);
4343

4444
/**
4545
* <strong>LOAD_LIBRARY_AS_DATAFILE</strong> <br>

contrib/platform/src/com/sun/jna/platform/win32/Mpr.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
public interface Mpr extends StdCallLibrary {
4444

45-
Mpr INSTANCE = Native.loadLibrary("Mpr", Mpr.class, W32APIOptions.DEFAULT_OPTIONS);
45+
Mpr INSTANCE = Native.load("Mpr", Mpr.class, W32APIOptions.DEFAULT_OPTIONS);
4646

4747
/**
4848
* The WNetOpenEnum function starts an enumeration of network resources or

contrib/platform/src/com/sun/jna/platform/win32/Msi.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*/
3333
public interface Msi extends StdCallLibrary {
3434

35-
Msi INSTANCE = Native.loadLibrary("msi", Msi.class, W32APIOptions.DEFAULT_OPTIONS);
35+
Msi INSTANCE = Native.load("msi", Msi.class, W32APIOptions.DEFAULT_OPTIONS);
3636

3737
/**
3838
* The component being requested is disabled on the computer.

contrib/platform/src/com/sun/jna/platform/win32/Netapi32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
*/
4141
public interface Netapi32 extends StdCallLibrary {
4242

43-
Netapi32 INSTANCE = Native.loadLibrary("Netapi32", Netapi32.class, W32APIOptions.DEFAULT_OPTIONS);
43+
Netapi32 INSTANCE = Native.load("Netapi32", Netapi32.class, W32APIOptions.DEFAULT_OPTIONS);
4444

4545
/**
4646
* Retrieves join status information for the specified computer.

contrib/platform/src/com/sun/jna/platform/win32/NtDll.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838
public interface NtDll extends StdCallLibrary {
3939

40-
NtDll INSTANCE = Native.loadLibrary("NtDll", NtDll.class, W32APIOptions.DEFAULT_OPTIONS);
40+
NtDll INSTANCE = Native.load("NtDll", NtDll.class, W32APIOptions.DEFAULT_OPTIONS);
4141

4242
/**
4343
* The ZwQueryKey routine provides information about the class of a registry key,

contrib/platform/src/com/sun/jna/platform/win32/Ole32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
public interface Ole32 extends StdCallLibrary {
4545

4646
/** The instance. */
47-
Ole32 INSTANCE = Native.loadLibrary("Ole32", Ole32.class, W32APIOptions.DEFAULT_OPTIONS);
47+
Ole32 INSTANCE = Native.load("Ole32", Ole32.class, W32APIOptions.DEFAULT_OPTIONS);
4848

4949
/**
5050
* Creates a GUID, a unique 128-bit integer used for CLSIDs and interface

contrib/platform/src/com/sun/jna/platform/win32/OleAuto.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
*/
5858
public interface OleAuto extends StdCallLibrary {
5959
/** The instance. */
60-
OleAuto INSTANCE = Native.loadLibrary("OleAut32", OleAuto.class, W32APIOptions.DEFAULT_OPTIONS);
60+
OleAuto INSTANCE = Native.load("OleAut32", OleAuto.class, W32APIOptions.DEFAULT_OPTIONS);
6161

6262
/* Flags for IDispatch::Invoke */
6363
/** The Constant DISPATCH_METHOD. */

contrib/platform/src/com/sun/jna/platform/win32/OpenGL32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* opengl32.dll Interface.
3333
*/
3434
public interface OpenGL32 extends StdCallLibrary {
35-
OpenGL32 INSTANCE = Native.loadLibrary("opengl32", OpenGL32.class);
35+
OpenGL32 INSTANCE = Native.load("opengl32", OpenGL32.class);
3636

3737
/**
3838
* The glGetString function returns a string describing the current OpenGL connection.

contrib/platform/src/com/sun/jna/platform/win32/Pdh.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @see <A HREF="https://msdn.microsoft.com/en-us/library/windows/desktop/aa373083(v=vs.85).aspx">Performance Counters</A>
4444
*/
4545
public interface Pdh extends StdCallLibrary {
46-
Pdh INSTANCE = Native.loadLibrary("Pdh", Pdh.class, W32APIOptions.DEFAULT_OPTIONS);
46+
Pdh INSTANCE = Native.load("Pdh", Pdh.class, W32APIOptions.DEFAULT_OPTIONS);
4747

4848
/** Maximum counter name length. */
4949
int PDH_MAX_COUNTER_NAME = 1024;

contrib/platform/src/com/sun/jna/platform/win32/Psapi.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
* @author Andreas "PAX" L&uuml;ck, onkelpax-git[at]yahoo.de
4646
*/
4747
public interface Psapi extends StdCallLibrary {
48-
Psapi INSTANCE = Native.loadLibrary("psapi", Psapi.class, W32APIOptions.DEFAULT_OPTIONS);
48+
Psapi INSTANCE = Native.load("psapi", Psapi.class, W32APIOptions.DEFAULT_OPTIONS);
4949

5050
/**
5151
* Retrieves the fully qualified path for the file containing the specified

contrib/platform/src/com/sun/jna/platform/win32/Rasapi32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* Rasapi32.dll Interface.
4545
*/
4646
public interface Rasapi32 extends StdCallLibrary {
47-
Rasapi32 INSTANCE = Native.loadLibrary("Rasapi32", Rasapi32.class, W32APIOptions.DEFAULT_OPTIONS);
47+
Rasapi32 INSTANCE = Native.load("Rasapi32", Rasapi32.class, W32APIOptions.DEFAULT_OPTIONS);
4848

4949
/**
5050
* The RasDial function establishes a RAS connection between a RAS client and a RAS server.

contrib/platform/src/com/sun/jna/platform/win32/Secur32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* @author dblock[at]dblock.org
4343
*/
4444
public interface Secur32 extends StdCallLibrary {
45-
Secur32 INSTANCE = Native.loadLibrary("Secur32", Secur32.class, W32APIOptions.DEFAULT_OPTIONS);
45+
Secur32 INSTANCE = Native.load("Secur32", Secur32.class, W32APIOptions.DEFAULT_OPTIONS);
4646

4747
/**
4848
* Specifies a format for a directory service object name.

contrib/platform/src/com/sun/jna/platform/win32/SetupApi.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
*/
4242
public interface SetupApi extends StdCallLibrary {
4343

44-
SetupApi INSTANCE = Native.loadLibrary("setupapi", SetupApi.class, W32APIOptions.DEFAULT_OPTIONS);
44+
SetupApi INSTANCE = Native.load("setupapi", SetupApi.class, W32APIOptions.DEFAULT_OPTIONS);
4545

4646
/**
4747
* The GUID_DEVINTERFACE_DISK device interface class is defined for hard disk storage devices.

contrib/platform/src/com/sun/jna/platform/win32/Shell32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*/
4343
public interface Shell32 extends ShellAPI, StdCallLibrary {
4444
/** The instance **/
45-
Shell32 INSTANCE = Native.loadLibrary("shell32", Shell32.class, W32APIOptions.DEFAULT_OPTIONS);
45+
Shell32 INSTANCE = Native.load("shell32", Shell32.class, W32APIOptions.DEFAULT_OPTIONS);
4646

4747
/**
4848
* No dialog box confirming the deletion of the objects will be displayed.

contrib/platform/src/com/sun/jna/platform/win32/Shlwapi.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import com.sun.jna.platform.win32.WinNT.*;
3636

3737
public interface Shlwapi extends StdCallLibrary {
38-
Shlwapi INSTANCE = Native.loadLibrary("Shlwapi", Shlwapi.class, W32APIOptions.DEFAULT_OPTIONS);
38+
Shlwapi INSTANCE = Native.load("Shlwapi", Shlwapi.class, W32APIOptions.DEFAULT_OPTIONS);
3939

4040
/**
4141
* Takes an STRRET structure returned by IShellFolder::GetDisplayNameOf and returns a pointer

contrib/platform/src/com/sun/jna/platform/win32/User32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
public interface User32 extends StdCallLibrary, WinUser, WinNT {
4646

4747
/** The instance. */
48-
User32 INSTANCE = Native.loadLibrary("user32", User32.class, W32APIOptions.DEFAULT_OPTIONS);
48+
User32 INSTANCE = Native.load("user32", User32.class, W32APIOptions.DEFAULT_OPTIONS);
4949

5050
/**
5151
* Handle for message-only window.

contrib/platform/src/com/sun/jna/platform/win32/Version.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*/
3434
public interface Version extends StdCallLibrary {
3535

36-
Version INSTANCE = Native.loadLibrary("version", Version.class, W32APIOptions.DEFAULT_OPTIONS);
36+
Version INSTANCE = Native.load("version", Version.class, W32APIOptions.DEFAULT_OPTIONS);
3737

3838
/**
3939
* Determines whether the operating system can retrieve version information for a specified file. If version

contrib/platform/src/com/sun/jna/platform/win32/Wevtapi.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* @author Minoru Sakamoto
3939
*/
4040
public interface Wevtapi extends StdCallLibrary {
41-
Wevtapi INSTANCE = (Wevtapi) Native.loadLibrary("wevtapi", Wevtapi.class, W32APIOptions.UNICODE_OPTIONS);
41+
Wevtapi INSTANCE = (Wevtapi) Native.load("wevtapi", Wevtapi.class, W32APIOptions.UNICODE_OPTIONS);
4242

4343
/**
4444
* Establishes a connection to a remote computer that you can use when calling the other Windows Event Log functions.

contrib/platform/src/com/sun/jna/platform/win32/Wininet.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public interface Wininet extends StdCallLibrary {
4141
/**
4242
* A usable instance of this interface
4343
*/
44-
Wininet INSTANCE = Native.loadLibrary("wininet", Wininet.class, W32APIOptions.DEFAULT_OPTIONS);
44+
Wininet INSTANCE = Native.load("wininet", Wininet.class, W32APIOptions.DEFAULT_OPTIONS);
4545

4646
/**
4747
* Normal cache entry; can be deleted to recover space for new entries.

contrib/platform/src/com/sun/jna/platform/win32/Winsock2.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
public interface Winsock2 extends Library {
3131

32-
Winsock2 INSTANCE = (Winsock2) Native.loadLibrary("ws2_32", Winsock2.class, W32APIOptions.ASCII_OPTIONS);
32+
Winsock2 INSTANCE = (Winsock2) Native.load("ws2_32", Winsock2.class, W32APIOptions.ASCII_OPTIONS);
3333

3434
/**
3535
* The gethostname function retrieves the standard host name for the local

contrib/platform/src/com/sun/jna/platform/win32/Winspool.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
*/
4747
public interface Winspool extends StdCallLibrary {
4848

49-
Winspool INSTANCE = Native.loadLibrary("Winspool.drv", Winspool.class, W32APIOptions.DEFAULT_OPTIONS);
49+
Winspool INSTANCE = Native.load("Winspool.drv", Winspool.class, W32APIOptions.DEFAULT_OPTIONS);
5050

5151
public static final int CCHDEVICENAME = 32;
5252

contrib/platform/src/com/sun/jna/platform/win32/Wtsapi32.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
public interface Wtsapi32 extends StdCallLibrary {
3232

33-
Wtsapi32 INSTANCE = Native.loadLibrary("Wtsapi32", Wtsapi32.class, W32APIOptions.DEFAULT_OPTIONS);
33+
Wtsapi32 INSTANCE = Native.load("Wtsapi32", Wtsapi32.class, W32APIOptions.DEFAULT_OPTIONS);
3434

3535
int NOTIFY_FOR_ALL_SESSIONS = 1;
3636

contrib/platform/src/com/sun/jna/platform/wince/CoreDLL.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
*/
3434
public interface CoreDLL extends WinNT, Library {
3535

36-
CoreDLL INSTANCE = Native.loadLibrary("coredll", CoreDLL.class, W32APIOptions.UNICODE_OPTIONS);
36+
CoreDLL INSTANCE = Native.load("coredll", CoreDLL.class, W32APIOptions.UNICODE_OPTIONS);
3737

3838
}

src/com/sun/jna/FunctionMapper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
/** Provides mapping of Java method names to native function names.
2929
* An instance of this interface may be provided to
30-
* {@link Native#loadLibrary(String, Class, java.util.Map)} as an entry in
30+
* {@link Native#load(String, Class, java.util.Map)} as an entry in
3131
* the options map with key {@link Library#OPTION_FUNCTION_MAPPER}.
3232
* <p>
3333
* There are several circumstances where this option might prove useful.

src/com/sun/jna/InvocationMapper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
/** Provide a method for overriding how a given function is invoked.
2929
* An instance of this interface may be provided to
30-
* {@link Native#loadLibrary(String, Class, java.util.Map)} as an entry in
30+
* {@link Native#load(String, Class, java.util.Map)} as an entry in
3131
* the options map with key {@link Library#OPTION_INVOCATION_MAPPER}.<p>
3232
* This is useful for implementing inlined functions, or functions which
3333
* are actually C preprocessor macros. Given a native library and JNA

0 commit comments

Comments
 (0)