fix loading issues on linux/mac

This commit is contained in:
Brian Matzon 2006-12-04 21:58:46 +00:00
parent 4aed85c5bb
commit 360da7c374
3 changed files with 25 additions and 13 deletions

View File

@ -5,10 +5,9 @@
#else
#include <dlfcn.h>
#include "extil.h"
#include <libgen.h>
static void* devILhandle;
#endif
#include "org_lwjgl_devil_ILNative.h";
#include "org_lwjgl_devil_ILNative.h"
/*
* Class: org_lwjgl_devil_ILNative
@ -68,7 +67,7 @@ bool extil_Open(JNIEnv *env, jobjectArray ilPaths) {
printfDebug("Testing '%s'\n", path_str);
#ifdef _WIN32
devILhandle = LoadLibrary(path_str);
#else
#elif __APPLE__ && __MACH__
char* directoryName = dirname(path_str);
char* fileName = basename(path_str);
char* currentDirectory = getwd(NULL);
@ -77,13 +76,18 @@ bool extil_Open(JNIEnv *env, jobjectArray ilPaths) {
}
devILhandle = dlopen(fileName, RTLD_LAZY);
if(devILhandle == NULL) {
printfDebug("dlopen failure: %s\n\n\n", dlerror());
printfDebug("dlopen failure: %s\n", dlerror());
}
chdir(currentDirectory);
free(currentDirectory);
#else
devILhandle = dlopen(path_str, RTLD_LAZY);
if(devILhandle == NULL) {
printfDebug("dlopen failure: %s\n", dlerror());
}
#endif
if (devILhandle != NULL) {
printfDebug("Found devil at '%s'\n", path_str);
printfDebug("Found IL at '%s'\n", path_str);
}
free(path_str);

View File

@ -5,7 +5,6 @@
#else
#include <dlfcn.h>
#include "extilu.h"
#include <libgen.h>
static void* devILUhandle;
#endif
@ -58,7 +57,7 @@ bool extilu_Open(JNIEnv *env, jobjectArray ilPaths) {
printfDebug("Testing '%s'\n", path_str);
#ifdef _WIN32
devILUhandle = LoadLibrary(path_str);
#else
#elif __APPLE__ && __MACH__
char* directoryName = dirname(path_str);
char* fileName = basename(path_str);
char* currentDirectory = getwd(NULL);
@ -67,13 +66,18 @@ bool extilu_Open(JNIEnv *env, jobjectArray ilPaths) {
}
devILUhandle = dlopen(fileName, RTLD_LAZY);
if(devILUhandle == NULL) {
printfDebug("dlopen failure: %s\n\n\n", dlerror());
printfDebug("dlopen failure: %s\n", dlerror());
}
chdir(currentDirectory);
free(currentDirectory);
#else
devILUhandle = dlopen(path_str, RTLD_LAZY);
if(devILUhandle == NULL) {
printfDebug("dlopen failure: %s\n", dlerror());
}
#endif
if (devILUhandle != NULL) {
printfDebug("Found ilu at '%s'\n", path_str);
printfDebug("Found ILU at '%s'\n", path_str);
}
free(path_str);

View File

@ -5,7 +5,6 @@
#else
#include <dlfcn.h>
#include "extilut.h"
#include <libgen.h>
static void* devILUThandle;
#endif
@ -58,7 +57,7 @@ bool extilut_Open(JNIEnv *env, jobjectArray ilPaths) {
printfDebug("Testing '%s'\n", path_str);
#ifdef _WIN32
devILUThandle = LoadLibrary(path_str);
#else
#elif __APPLE__ && __MACH__
char* directoryName = dirname(path_str);
char* fileName = basename(path_str);
char* currentDirectory = getwd(NULL);
@ -67,13 +66,18 @@ bool extilut_Open(JNIEnv *env, jobjectArray ilPaths) {
}
devILUThandle = dlopen(fileName, RTLD_LAZY);
if(devILUThandle == NULL) {
printfDebug("dlopen failure: %s\n\n\n", dlerror());
printfDebug("dlopen failure: %s\n", dlerror());
}
chdir(currentDirectory);
free(currentDirectory);
#else
devILUThandle = dlopen(path_str, RTLD_LAZY);
if(devILUThandle == NULL) {
printfDebug("dlopen failure: %s\n", dlerror());
}
#endif
if (devILUThandle != NULL) {
printfDebug("Found ilut at '%s'\n", path_str);
printfDebug("Found ILUT at '%s'\n", path_str);
}
free(path_str);