mirror of
https://github.com/corda/corda.git
synced 2025-06-17 22:58:19 +00:00
The proper extension for Mac JNI libraries is .jnilib. Hard-coded constants
have been factored to common locations. Furthermore, the LD_LIBRARY_PATH environment variable is DYLD_LIBRARY_PATH on Mac OS X.
This commit is contained in:
@ -6,6 +6,12 @@
|
||||
#include "jni.h"
|
||||
#include "jni-util.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define SO_SUFFIX ".jnilib"
|
||||
#else
|
||||
#define SO_SUFFIX ".so"
|
||||
#endif
|
||||
|
||||
#undef JNIEXPORT
|
||||
#define JNIEXPORT __attribute__ ((visibility("default")))
|
||||
|
||||
@ -54,9 +60,9 @@ Java_java_lang_System_doMapLibraryName(JNIEnv* e, jclass, jstring name)
|
||||
const char* chars = e->GetStringUTFChars(name, 0);
|
||||
if (chars) {
|
||||
unsigned nameLength = strlen(chars);
|
||||
unsigned size = nameLength + 7;
|
||||
unsigned size = nameLength + 3 + sizeof(SO_SUFFIX);
|
||||
char buffer[size];
|
||||
snprintf(buffer, size, "lib%s.so", chars);
|
||||
snprintf(buffer, size, "lib%s" SO_SUFFIX, chars);
|
||||
r = e->NewStringUTF(buffer);
|
||||
|
||||
e->ReleaseStringUTFChars(name, chars);
|
||||
|
Reference in New Issue
Block a user