From 0f770551cebca90c92b7a39b0e0135a445af51f9 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Sat, 22 Mar 2008 02:28:22 +0000 Subject: merging in pdj-0.8.4.tar.gz from http://www.le-son666.com/software/pdj/ svn path=/trunk/externals/loaders/pdj/; revision=9624 --- src/pdj-linux.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/pdj-linux.c') diff --git a/src/pdj-linux.c b/src/pdj-linux.c index 63bb015..5af919f 100644 --- a/src/pdj-linux.c +++ b/src/pdj-linux.c @@ -4,6 +4,19 @@ #include #include "pdj.h" +// test if this system is amd64 +#ifdef __LP64__ + #define ARCH "amd64" + #define MAPPOS 73 +#else + #define ARCH "i386" + #define MAPPOS 49 +#endif + +/* + * This is why it is called getuglylibpath... getting the info from /proc... + * if you have a better idea; well I would like to be informed + */ int getuglylibpath(char *path) { char buffer[BUFFER_SIZE]; FILE *f; @@ -20,7 +33,7 @@ int getuglylibpath(char *path) { fgets(buffer, BUFFER_SIZE-1, f); if ( strstr(buffer, "pdj.pd_linux") != NULL ) { buffer[strlen(buffer) - 14] = 0; - strcpy(path, buffer+49); + strcpy(path, buffer + MAPPOS); fclose(f); return 0; } @@ -43,7 +56,7 @@ JNI_CreateJavaVM_func *linkjvm(char *vm_type) { if ( javahome == NULL ) { javahome = getenv("JAVA_HOME"); } else { - sprintf(work, "%s/jre/lib/i386/%s/libjvm.so", javahome, vm_type); + sprintf(work, "%s/jre/lib/" ARCH "/%s/libjvm.so", javahome, vm_type); libVM = dlopen(work, RTLD_LAZY); if ( libVM == NULL ) { @@ -60,20 +73,20 @@ JNI_CreateJavaVM_func *linkjvm(char *vm_type) { /* using LD_LIBRARY_PATH + putenv doesn't work, load std jvm libs * with absolute path. order is important. */ - sprintf(work, "%s/jre/lib/i386/%s/libjvm.so", javahome, vm_type); + sprintf(work, "%s/jre/lib/" ARCH "/%s/libjvm.so", javahome, vm_type); dlopen(work, RTLD_LAZY); - sprintf(work, "%s/jre/lib/i386/libverify.so", javahome); + sprintf(work, "%s/jre/lib/" ARCH "/libverify.so", javahome); dlopen(work, RTLD_LAZY); - sprintf(work, "%s/jre/lib/i386/libjava.so", javahome); + sprintf(work, "%s/jre/lib/" ARCH "/libjava.so", javahome); dlopen(work, RTLD_LAZY); - sprintf(work, "%s/jre/lib/i386/libmlib_image.so", javahome); + sprintf(work, "%s/jre/lib/" ARCH "/libmlib_image.so", javahome); dlopen(work, RTLD_LAZY); /* ELF should support dynamic LD_LIBRARY_PATH :( :( :( */ - sprintf(work, "%s/jre/lib/i386/libjava.so", javahome); + sprintf(work, "%s/jre/lib/" ARCH "/libjava.so", javahome); libVM = dlopen(work, RTLD_LAZY); } -- cgit v1.2.1