JNIEXPORT void JNICALL Java_org_lwjgl_WindowsSysImplementation_nAlert(JNIEnv * env, jclass unused, jlong hwnd_ptr, jstring title, jstring message) { HWND hwnd = (HWND)(INT_PTR)hwnd_ptr; char * eMessageText = GetStringNativeChars(env, message); char * cTitleBarText = GetStringNativeChars(env, title); MessageBox(hwnd, eMessageText, cTitleBarText, MB_OK | MB_TOPMOST); printfDebugJava(env, "*** Alert ***%s\n%s\n", cTitleBarText, eMessageText); free(eMessageText); free(cTitleBarText); }
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_GLContext_getFunctionAddress(JNIEnv *env, jclass clazz, jstring function_name) { jlong address_jlong; char *function_name_pointer = GetStringNativeChars(env, function_name); void *address = extgl_GetProcAddress(function_name_pointer); free(function_name_pointer); address_jlong = (jlong)(intptr_t)address; return address_jlong; }
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nInternAtom(JNIEnv *env, jclass unused, jlong display_ptr, jstring atom_name_obj, jboolean only_if_exists) { Display *disp = (Display *)(intptr_t)display_ptr; char *atom_name = GetStringNativeChars(env, atom_name_obj); if (atom_name == NULL) return 0; Atom atom = XInternAtom(disp, atom_name, only_if_exists ? True : False); free(atom_name); return atom; }
void extcl_LoadLibrary(JNIEnv *env, jstring path) { char *path_str = GetStringNativeChars(env, path); printfDebugJava(env, "Testing '%s'", path_str); handleOCL = dlopen(path_str, RTLD_LAZY); if (handleOCL != NULL) { printfDebugJava(env, "Found OpenCL at '%s'", path_str); } else { throwException(env, "Could not load OpenCL library"); } free(path_str); }
void extal_LoadLibrary(JNIEnv *env, jstring path) { char *path_str = GetStringNativeChars(env, path); printfDebugJava(env, "Testing '%s'", path_str); handleOAL = LoadLibrary(path_str); if (handleOAL != NULL) { printfDebugJava(env, "Found OpenAL at '%s'", path_str); } else { throwFormattedException(env, "Could not load OpenAL library (%d)", GetLastError()); } free(path_str); }
/* * Class: org_lwjgl_openal_ALC11 * Method: nalcCaptureOpenDevice * Signature: (Ljava/lang/String;III)J */ static jlong JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice(JNIEnv *env, jclass clazz, jstring devicename, jint frequency, jint format, jint buffersize) { ALubyte* dev_name = NULL; ALCdevice* device = NULL; if(devicename != NULL) { dev_name = (ALubyte*) GetStringNativeChars(env, devicename); } device = alcCaptureOpenDevice((const char *)dev_name, (unsigned int) frequency, format, buffersize); free(dev_name); return (jlong) ((intptr_t)device); }
JNIEXPORT jstring JNICALL Java_org_lwjgl_opengl_WindowsRegistry_nQueryRegistrationKey (JNIEnv *env, jclass unused, jint root_key, jstring subkey, jstring value) { HKEY root = enumToRootKey(root_key); char *subkey_native; char *value_native; jstring result; subkey_native = GetStringNativeChars(env, subkey); if (subkey_native == NULL) { throwException(env, "Failed to fetch the native string"); return NULL; } value_native = GetStringNativeChars(env, value); if (value_native == NULL) { free(subkey_native); throwException(env, "Failed to fetch the native string"); return NULL; } result = queryRegistrationKey(env, root, subkey_native, value_native); free(subkey_native); free(value_native); return result; }
static jint JNICALL Java_org_lwjgl_openal_AL10_nalGetEnumValue(JNIEnv *env, jclass clazz, jobject ename) { ALubyte *ename_address = (ALubyte *)(intptr_t)GetStringNativeChars(env, ename); ALenum __result = alGetEnumValue(ename_address); free(ename_address); return __result; }
static jboolean JNICALL Java_org_lwjgl_openal_AL10_nalIsExtensionPresent(JNIEnv *env, jclass clazz, jobject fname) { ALubyte *fname_address = (ALubyte *)(intptr_t)GetStringNativeChars(env, fname); ALboolean __result = alIsExtensionPresent(fname_address); free(fname_address); return __result; }