Top


定義場所(file name)

hotspot/src/share/vm/prims/jvm.cpp

名前(function name)

JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* name))

本体部(body)

      //%note jvm_ct

  {- -------------------------------------------
  (1) (トレース出力) (See: JVMWrapper2)
      ---------------------------------------- -}

      JVMWrapper2("JVM_LoadLibrary (%s)", name);

  {- -------------------------------------------
  (1) (変数宣言など)
      ---------------------------------------- -}

      char ebuf[1024];
      void *load_result;

  {- -------------------------------------------
  (1) os::dll_load() でライブラリをロードする.
      ---------------------------------------- -}

      {
        ThreadToNativeFromVM ttnfvm(thread);
        load_result = os::dll_load(name, ebuf, sizeof ebuf);
      }

  {- -------------------------------------------
  (1) もしロードが失敗していたら, UnsatisfiedLinkError.
      ---------------------------------------- -}

      if (load_result == NULL) {
        char msg[1024];
        jio_snprintf(msg, sizeof msg, "%s: %s", name, ebuf);
        // Since 'ebuf' may contain a string encoded using
        // platform encoding scheme, we need to pass
        // Exceptions::unsafe_to_utf8 to the new_exception method
        // as the last argument. See bug 6367357.
        Handle h_exception =
          Exceptions::new_exception(thread,
                                    vmSymbols::java_lang_UnsatisfiedLinkError(),
                                    msg, Exceptions::unsafe_to_utf8);

        THROW_HANDLE_0(h_exception);
      }

  {- -------------------------------------------
  (1) ロードが成功していれば, その結果をリターンする.
      ---------------------------------------- -}

      return load_result;
    JVM_END

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.