Runtime.java (loadLibraryInternal): Declare.

* java/lang/Runtime.java (loadLibraryInternal): Declare.
	* java/lang/natClassLoader.cc (_Jv_FindClass): Removed dead copy.
	(_Jv_FindClassInCache): Likewise.
	(_Jv_FindClass): Don't conditionalize body on INTERPRETER.
	(findSystemClass): Try to load class from compiled module.
	Include Runtime.h.
	* java/lang/natRuntime.cc (load): Use UTF-8 copy of filename.
	(loadLibrary): Likewise.
	(lt_preloaded_symbols): Define.
	(loadLibraryInternal): New method.
	* include/config.h.in: Rebuilt.
	* acconfig.h (USE_LTDL): Added.
	* Makefile.am (SUBDIRS): Added $(DIRLTDL).
	(INCLUDES): Added $(INCLTDL).b
	(libgcj_la_DEPENDENCIES): Added $(LIBLTDL).
	(libgcj_la_LIBADD): Likewise.
	* aclocal.m4, configure: Rebuilt.
	* configure.in: Added libltdl support.

From-SVN: r31472
This commit is contained in:
Tom Tromey 2000-01-17 19:22:20 +00:00 committed by Tom Tromey
parent 06f5673716
commit 7af8555855
14 changed files with 539 additions and 901 deletions

View file

@ -1,6 +1,6 @@
// natRuntime.cc - Implementation of native side of Runtime class.
/* Copyright (C) 1998, 1999 Cygnus Solutions
/* Copyright (C) 1998, 1999, 2000 Cygnus Solutions
This file is part of libgcj.
@ -20,6 +20,10 @@ details. */
#ifdef USE_LTDL
#include <ltdl.h>
/* FIXME: we don't always need this. The next libtool will let us use
AC_LTDL_PREOPEN to see if we do. */
const lt_dlsymlist lt_preloaded_symbols[1] = { { 0, 0 } };
#endif
void
@ -56,8 +60,12 @@ java::lang::Runtime::load (jstring path)
checkLink (path);
using namespace java::lang;
#ifdef USE_LTDL
jint len = _Jv_GetStringUTFLength (path);
char buf[len + 1];
jsize total = JvGetStringUTFRegion (path, 0, path->length(), buf);
buf[total] = '\0';
// FIXME: make sure path is absolute.
lt_dlhandle h = lt_dlopen (FIXME);
lt_dlhandle h = lt_dlopen (buf);
if (h == NULL)
{
const char *msg = lt_dlerror ();
@ -76,8 +84,12 @@ java::lang::Runtime::loadLibrary (jstring lib)
checkLink (lib);
using namespace java::lang;
#ifdef USE_LTDL
jint len = _Jv_GetStringUTFLength (lib);
char buf[len + 1];
jsize total = JvGetStringUTFRegion (lib, 0, lib->length(), buf);
buf[total] = '\0';
// FIXME: make sure path is absolute.
lt_dlhandle h = lt_dlopenext (FIXME);
lt_dlhandle h = lt_dlopenext (buf);
if (h == NULL)
{
const char *msg = lt_dlerror ();
@ -89,6 +101,24 @@ java::lang::Runtime::loadLibrary (jstring lib)
#endif /* USE_LTDL */
}
jboolean
java::lang::Runtime::loadLibraryInternal (jstring lib)
{
JvSynchronize sync (this);
using namespace java::lang;
#ifdef USE_LTDL
jint len = _Jv_GetStringUTFLength (lib);
char buf[len + 1];
jsize total = JvGetStringUTFRegion (lib, 0, lib->length(), buf);
buf[total] = '\0';
// FIXME: make sure path is absolute.
lt_dlhandle h = lt_dlopenext (buf);
return h != NULL;
#else
return false;
#endif /* USE_LTDL */
}
void
java::lang::Runtime::init (void)
{