Skip to content

Commit 67a1dd4

Browse files
committed
ohos: Only look for libEGL.so
This avoids needless overhead and error messages in the console when loading `libEGL.so.1` fails.
1 parent 4108db0 commit 67a1dd4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/platform/generic/egl/device.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,17 @@ static EGL_LIBRARY: LazyLock<EGLLibraryWrapper> = LazyLock::new(|| unsafe {
2525
EGLLibraryWrapper(module)
2626
});
2727

28+
#[cfg(target_env = "ohos")]
29+
static EGL_POTENTIAL_SO_NAMES: [&CStr; 1] = [c"libEGL.so"];
30+
31+
#[cfg(not(any(target_os = "windows", target_os = "macos", target_env = "ohos")))]
32+
static EGL_POTENTIAL_SO_NAMES: [&CStr; 2] = [c"libEGL.so.1", c"libEGL.so"];
33+
2834
#[cfg(not(any(target_os = "windows", target_os = "macos")))]
2935
static EGL_LIBRARY: LazyLock<EGLLibraryWrapper> = LazyLock::new(|| {
30-
for soname in [c"libEGL.so.1".as_ptr(), c"libEGL.so".as_ptr()] {
36+
for soname in EGL_POTENTIAL_SO_NAMES {
3137
unsafe {
32-
let handle = dlopen(soname as *const _, RTLD_LAZY);
38+
let handle = dlopen(soname.as_ptr(), RTLD_LAZY);
3339
if !handle.is_null() {
3440
return EGLLibraryWrapper(handle);
3541
}

0 commit comments

Comments
 (0)