System File Chooser: Linux: cross-compile native library for ARM64 on x86_64 Linux

This commit is contained in:
Karl Tauber
2025-01-19 16:11:42 +01:00
parent 0a4c01cd40
commit d524536575
8 changed files with 96 additions and 4 deletions

View File

@@ -17,6 +17,7 @@
// avoid inlining of printf()
#define _NO_CRT_STDIO_INLINE
#include <dlfcn.h>
#include "JNIUtils.h"
/**
@@ -35,3 +36,19 @@ AutoReleaseStringUTF8::~AutoReleaseStringUTF8() {
if( chars != NULL )
env->ReleaseStringUTFChars( javaString, chars );
}
//---- JNI methods ------------------------------------------------------------
extern "C"
JNIEXPORT jboolean JNICALL Java_com_formdev_flatlaf_ui_FlatNativeLinuxLibrary_isLibAvailable
( JNIEnv* env, jclass cls, jstring libname )
{
AutoReleaseStringUTF8 clibname( env, libname );
void* lib = dlopen( clibname, RTLD_LAZY );
if( lib == NULL )
return false;
dlclose( lib );
return true;
}