Java_java_lang_System_mapLibraryName Does this need to be native?

Michael Franz mvfranz at gmail.com
Mon Oct 6 18:44:18 PDT 2008


Hi,

After looking at Java_java_lang_System_mapLibraryName I am wondering why
this has to be a native method?  It seems that the only benefit to being
native is that JNI_LIB_PREFIX and JNI_LIB_SUFFIX are defined using defines
in the platform header files.

Being a much stronger Java programmer than a C programmer, I would prefer to
have a way to get the two values (JNI_LIB_PREFIX and JNI_LIB_SUFFIX) and
manipulate the string building using StringBuilder.

If that is not feasible I would try to create a new method that returns a
String[] of the possible library names.  Since I am interested in the OS X
version a load of abc would return:

return new String[] { "libabc.dylib", "libabc.jnilib" }

Then ClassLoader.loadLibrary can loop over the string array when it is
searching the sys_paths.  This method would also work for cases where there
are multiple choices for the JNI_LIB_PREFIX.

Comments?

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/bsd-port-dev/attachments/20081006/653d1ac1/attachment.html 


More information about the bsd-port-dev mailing list