Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_VMRuntime.c 5900 2006-11-04 17:30:44Z michi $
-
*/
#include "vm/types.h"
#include "native/jni.h"
+#include "native/native.h"
#include "native/include/java_lang_String.h"
+#include "native/include/com_sun_cldchi_jvm_JVM.h"
+
#include "native/vm/java_lang_Runtime.h"
+#include "vm/exceptions.h"
+#include "vm/stringlocal.h"
+
+
+/* native methods implemented by this file ************************************/
+
+static JNINativeMethod methods[] = {
+ { "loadLibrary", "(Ljava/lang/String;)V", (void *) (ptrint) &Java_com_sun_cldchi_jvm_JVM_loadLibrary },
+};
+
+
+/* _Jv_com_sun_cldchi_jvm_JVM_init *********************************************
+
+ Register native functions.
+
+*******************************************************************************/
+
+void _Jv_com_sun_cldchi_jvm_JVM_init(void)
+{
+ utf *u;
+
+ u = utf_new_char("com/sun/cldchi/jvm/JVM");
+
+ native_method_register(u, methods, NATIVE_METHODS_COUNT);
+}
+
/*
* Class: com/sun/cldchi/jvm/JVM
*/
JNIEXPORT void JNICALL Java_com_sun_cldchi_jvm_JVM_loadLibrary(JNIEnv *env, jclass clazz, java_lang_String *libName)
{
+ s4 result;
+ utf *name;
+
#if defined(ENABLE_JNI)
- (void) _Jv_java_lang_Runtime_loadLibrary(env, libName, NULL);
+ result = _Jv_java_lang_Runtime_loadLibrary(env, libName, NULL);
#else
- (void) _Jv_java_lang_Runtime_loadLibrary(libName, NULL);
+ result = _Jv_java_lang_Runtime_loadLibrary(libName, NULL);
#endif
+
+ /* check for error and throw one in case */
+
+ if (result == 0) {
+ name = javastring_toutf((java_handle_t *) libName, false);
+ exceptions_throw_unsatisfiedlinkerror(name);
+ }
}