Hey Rick,
Am Dienstag, den 23.10.2018, 17:19 -0700 schrieb Rick Ley:
> WinNT.HANDLE handle = Advapi32.INSTANCE.RegisterEventSource(null, "JavaTest");
> String[] eventText = {"Test String"};
> Advapi32.INSTANCE.ReportEvent(handle, 4, 0, 123, null, 1, 0, eventText, null);
>
> which is throwing the following exceptions on the call to RegisterEventSource:
> Exception in thread "main" java.lang.NoSuchFieldError: SIZE
> at com.sun.jna.platform.win32.WinBase.<clinit>(WinBase.java:52)
> at com.sun.jna.platform.win32.WinNT$HANDLE.fromNative(WinNT.java:1366)
> at com.sun.jna.NativeMappedConverter.fromNative(NativeMappedConverter.java:78)
> at com.sun.jna.Function.invoke(Function.java:369)
> at com.sun.jna.Library$Handler.invoke(Library.java:244)
> at com.sun.proxy.$Proxy0.RegisterEventSource(Unknown Source)
> at Main.main(Main.java:81)
>
> I have tested that I am able to load the Advapi32 library directly by
> calling System.loadLibrary, so I don't think that is the issue. From
> looking at the tests on the GitHub repo, it looks like I am using it
> similarly. The line the exception comes from is initializing an int
> to a constant value, so I'm not sure where SIZE is coming from.
you are mixing Versions. The field Pointer#SIZE was removed in the
transition from 4.5.2 to 5.0.0. The error you are seeing can be
explained, if jna 4.5.X and jna-platform 5.0.0 are used together.
So I suggest you check your dependencies.
Matthias