@ -1,11 +1,14 @@
# include "jaggl_X11_dri.h"
# include "jaggl_X11_dri.h"
# if defined(__unix__)
# include <dlfcn.h>
# include <dlfcn.h>
# include <stddef.h>
# include <stddef.h>
static void * jaggl_dri_handle ;
static void * jaggl_dri_handle ;
# endif
JNIEXPORT jboolean JNICALL Java_jaggl_X11_dri_open ( JNIEnv * env , jclass cls , jstring path ) {
JNIEXPORT jboolean JNICALL Java_jaggl_X11_dri_open ( JNIEnv * env , jclass cls , jstring path ) {
# if defined(__unix__)
if ( jaggl_dri_handle ) {
if ( jaggl_dri_handle ) {
dlclose ( jaggl_dri_handle ) ;
dlclose ( jaggl_dri_handle ) ;
jaggl_dri_handle = NULL ;
jaggl_dri_handle = NULL ;
@ -16,14 +19,19 @@ JNIEXPORT jboolean JNICALL Java_jaggl_X11_dri_open(JNIEnv *env, jclass cls, jstr
( * env ) - > ReleaseStringUTFChars ( env , path , path_str ) ;
( * env ) - > ReleaseStringUTFChars ( env , path , path_str ) ;
return jaggl_dri_handle ! = NULL ;
return jaggl_dri_handle ! = NULL ;
# else
return JNI_FALSE ;
# endif
}
}
JNIEXPORT jboolean JNICALL Java_jaggl_X11_dri_close ( JNIEnv * env , jclass cls ) {
JNIEXPORT jboolean JNICALL Java_jaggl_X11_dri_close ( JNIEnv * env , jclass cls ) {
# if defined(__unix__)
if ( jaggl_dri_handle ) {
if ( jaggl_dri_handle ) {
dlclose ( jaggl_dri_handle ) ;
dlclose ( jaggl_dri_handle ) ;
jaggl_dri_handle = NULL ;
jaggl_dri_handle = NULL ;
return JNI_TRUE ;
return JNI_TRUE ;
}
}
# endif
return JNI_FALSE ;
return JNI_FALSE ;
}
}