2004-12-08 14:15:50 -05:00
|
|
|
#include "extil.h"
|
|
|
|
|
|
|
|
/* turn off the warning for the borland compiler*/
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma warn -8064
|
|
|
|
#pragma warn -8065
|
|
|
|
#endif /* __BORLANDC__ */
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
HMODULE devILhandle = NULL;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* getProcAddress */
|
|
|
|
|
|
|
|
void *extil_GetProcAddress(const char *name) {
|
|
|
|
#ifdef _WIN32
|
|
|
|
void *t = GetProcAddress(devILhandle, name);
|
|
|
|
|
|
|
|
|
|
|
|
if (t == NULL) {
|
|
|
|
printfDebug("Could not locate symbol %s\n", name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return t;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void extil_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) {
|
|
|
|
ext_InitializeClass(env, clazz, &extil_GetProcAddress, num_functions, functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool extil_InitializeFunctions(int num_functions, ExtFunction *functions) {
|
|
|
|
return ext_InitializeFunctions(&extil_GetProcAddress, num_functions, functions);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
bool extil_Open(JNIEnv *env) {
|
|
|
|
bool result = true;
|
|
|
|
|
|
|
|
if (devILhandle == NULL) {
|
|
|
|
// load the dynamic libraries for DevIL
|
2004-12-09 20:42:00 -05:00
|
|
|
devILhandle = LoadLibrary("DevIL.dll");
|
2004-12-08 14:15:50 -05:00
|
|
|
if (devILhandle == NULL) {
|
|
|
|
printf("\r\nfailed to load DevIL");
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
#endif /* WIN32 */
|
|
|
|
|
2004-12-12 05:13:55 -05:00
|
|
|
void extil_Close(void) {
|
2004-12-08 14:15:50 -05:00
|
|
|
#ifdef _WIN32
|
|
|
|
FreeLibrary(devILhandle);
|
|
|
|
devILhandle = NULL;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* turn on the warning for the borland compiler*/
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma warn .8064
|
|
|
|
#pragma warn .8065
|
|
|
|
#endif /* __BORLANDC__ */
|
|
|
|
|