1 // natRuntime.cc - Implementation of native side of Runtime class.
3 /* Copyright (C) 1998, 1999 Cygnus Solutions
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
17 #include <java/lang/Runtime.h>
18 #include <java/lang/UnknownError.h>
19 #include <java/lang/UnsatisfiedLinkError.h>
26 java::lang::Runtime::exit (jint status)
30 // Make status right for Unix. This is perhaps strange.
31 if (status < 0 || status > 255)
35 _Jv_RunAllFinalizers ();
41 java::lang::Runtime::freeMemory (void)
43 return _Jv_GCFreeMemory ();
47 java::lang::Runtime::gc (void)
53 java::lang::Runtime::load (jstring path)
55 JvSynchronize sync (this);
57 using namespace java::lang;
59 // FIXME: make sure path is absolute.
60 lt_dlhandle h = lt_dlopen (FIXME);
63 const char *msg = lt_dlerror ();
64 _Jv_Throw (new UnsatisfiedLinkError (JvNewStringLatin1 (msg)));
67 _Jv_Throw (new UnknownError
68 (JvNewStringLatin1 ("Runtime.load not implemented")));
73 java::lang::Runtime::loadLibrary (jstring lib)
75 JvSynchronize sync (this);
77 using namespace java::lang;
79 // FIXME: make sure path is absolute.
80 lt_dlhandle h = lt_dlopenext (FIXME);
83 const char *msg = lt_dlerror ();
84 _Jv_Throw (new UnsatisfiedLinkError (JvNewStringLatin1 (msg)));
87 _Jv_Throw (new UnknownError
88 (JvNewStringLatin1 ("Runtime.loadLibrary not implemented")));
93 java::lang::Runtime::init (void)
95 finalize_on_exit = false;
102 java::lang::Runtime::runFinalization (void)
104 _Jv_RunFinalizers ();
108 java::lang::Runtime::totalMemory (void)
110 return _Jv_GCTotalMemory ();
114 java::lang::Runtime::traceInstructions (jboolean)
120 java::lang::Runtime::traceMethodCalls (jboolean)