Makefile.in: Rebuilt.
* Makefile.in: Rebuilt. * Makefile.am (CLEANFILES): Don't mention $(class_files). (clean-local): New target * java/lang/natRuntime.cc: Include <ltdl.h> if required. (load, loadLibrary): Now native. (init): New method. * java/lang/Runtime.java (load, loadLibrary): Now native. (init): New native method. (Runtime): Use init. * prims.cc: Include <ltdl.h> if required. (JvRunMain): Call LTDL_SET_PRELOADED_SYMBOLS. From-SVN: r26785
This commit is contained in:
parent
8b04083bec
commit
9096b279c2
6 changed files with 94 additions and 16 deletions
|
@ -94,18 +94,8 @@ public class Runtime
|
|||
s.checkLink(lib);
|
||||
}
|
||||
|
||||
public synchronized void load (String pathname)
|
||||
{
|
||||
checkLink (pathname);
|
||||
// FIXME.
|
||||
throw new UnsatisfiedLinkError ("Runtime.load not implemented");
|
||||
}
|
||||
public synchronized void loadLibrary (String libname)
|
||||
{
|
||||
checkLink (libname);
|
||||
// FIXME.
|
||||
throw new UnsatisfiedLinkError ("Runtime.loadLibrary not implemented");
|
||||
}
|
||||
public native void load (String pathname);
|
||||
public native void loadLibrary (String libname);
|
||||
|
||||
public native void runFinalization ();
|
||||
|
||||
|
@ -122,10 +112,13 @@ public class Runtime
|
|||
public native void traceInstructions (boolean on);
|
||||
public native void traceMethodCalls (boolean on);
|
||||
|
||||
// A helper for the constructor.
|
||||
private final native void init ();
|
||||
|
||||
// The sole constructor.
|
||||
private Runtime ()
|
||||
{
|
||||
finalize_on_exit = false;
|
||||
init ();
|
||||
}
|
||||
|
||||
// Private data.
|
||||
|
|
|
@ -15,6 +15,12 @@ details. */
|
|||
#include <cni.h>
|
||||
#include <jvm.h>
|
||||
#include <java/lang/Runtime.h>
|
||||
#include <java/lang/UnknownError.h>
|
||||
#include <java/lang/UnsatisfiedLinkError.h>
|
||||
|
||||
#ifdef USE_LTDL
|
||||
#include <ltdl.h>
|
||||
#endif
|
||||
|
||||
void
|
||||
java::lang::Runtime::exit (jint status)
|
||||
|
@ -43,6 +49,55 @@ java::lang::Runtime::gc (void)
|
|||
_Jv_RunGC ();
|
||||
}
|
||||
|
||||
void
|
||||
java::lang::Runtime::load (jstring path)
|
||||
{
|
||||
JvSynchronize sync (this);
|
||||
checkLink (path);
|
||||
using namespace java::lang;
|
||||
#ifdef USE_LTDL
|
||||
// FIXME: make sure path is absolute.
|
||||
lt_dlhandle h = lt_dlopen (FIXME);
|
||||
if (h == NULL)
|
||||
{
|
||||
const char *msg = lt_dlerror ();
|
||||
_Jv_Throw (new UnsatisfiedLinkError (JvNewStringLatin1 (msg)));
|
||||
}
|
||||
#else
|
||||
_Jv_Throw (new UnknownError
|
||||
(JvNewStringLatin1 ("Runtime.load not implemented")));
|
||||
#endif /* USE_LTDL */
|
||||
}
|
||||
|
||||
void
|
||||
java::lang::Runtime::loadLibrary (jstring lib)
|
||||
{
|
||||
JvSynchronize sync (this);
|
||||
checkLink (lib);
|
||||
using namespace java::lang;
|
||||
#ifdef USE_LTDL
|
||||
// FIXME: make sure path is absolute.
|
||||
lt_dlhandle h = lt_dlopenext (FIXME);
|
||||
if (h == NULL)
|
||||
{
|
||||
const char *msg = lt_dlerror ();
|
||||
_Jv_Throw (new UnsatisfiedLinkError (JvNewStringLatin1 (msg)));
|
||||
}
|
||||
#else
|
||||
_Jv_Throw (new UnknownError
|
||||
(JvNewStringLatin1 ("Runtime.loadLibrary not implemented")));
|
||||
#endif /* USE_LTDL */
|
||||
}
|
||||
|
||||
void
|
||||
java::lang::Runtime::init (void)
|
||||
{
|
||||
finalize_on_exit = false;
|
||||
#ifdef USE_LTDL
|
||||
lt_dlinit ();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
java::lang::Runtime::runFinalization (void)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue