On Thu, 5 Nov 2020 02:44:01 GMT, John Neffenger
<[email protected]> wrote:
>> Johan Vos has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> add one more @override to process reviewer comments
>
> modules/javafx.graphics/src/main/java/com/sun/glass/ui/monocle/EGLPlatform.java
> line 42:
>
>> 40: }
>> 41: }
>> 42: }
>
> I changed the constructor to the following:
>
> import com.sun.glass.utils.NativeLibLoader;
>
> public EGLPlatform() {
> String lib = System.getProperty("monocle.egl.lib");
> if (lib != null) {
> NativeLibLoader.loadLibrary(lib);
> }
> }
>
> Using the `NativeLibLoader` allowed me to define my native library with
> `monocle.egl.lib=test01` (instead of `libtest01.so`) and drop it in the
> JavaFX SDK with all the other JavaFX libraries. You also get good error
> messages when it fails.
>
> The current code did load the library after adding its path to the
> environment variable `LD_LIBRARY_PATH`, but it failed with the following
> message on first use:
>
> java.lang.UnsatisfiedLinkError:
> 'long com.sun.glass.ui.monocle.EGLAcceleratedScreen
> .nPlatformGetNativeWindow(java.lang.String)'
>
> The call to `NativeLibLoader` solved these problems, with no
> `LD_LIBRARY_PATH` required.
The difference between how I'm building it and how you are building is that I
combine all monocle code in 1 library (libglass_monocle.so) where you have a
common monocle library and a egl-specific one -- and this is what you do with
the EPD as well. For Android, we use a single library as well. At build time,
the android-specific classes are added in libglass_monocle.so and dlopen() is
used to load android-specific libraries at runtime.
Both approaches are valid, but can't be mixed. Hence we need to decide to
either go for 1 or 2 monocle libraries (the android approach, where there is
libglass_monocle only or the epd approach where there is also
libglass_monocle_epd). I don't have a strong preference, but I think
libglass_monocle will be really very small.
Bundling the device-specific library (in your case the one containing test01.o)
with the monocle library (the general or a specific one) seems less
interesting, as that means you need e.g. 4 different monocle libraries for 4
different Pi-configurations. I believe it is better to share the monocle
libraries, and have a single OpenJFX library for monocle, and then
platform/configuration-specific libraries.
-------------
PR: https://git.openjdk.java.net/jfx/pull/343