IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
LibJava.cs
Go to the documentation of this file.
1using System;
2using System.IO;
3
4namespace IKVM.Runtime
5{
6
7#if FIRST_PASS == false && IMPORTER == false && EXPORTER == false
8
16 internal unsafe class LibJava
17 {
18
22 public static readonly LibJava Instance = new();
23
27 LibJava()
28 {
29 // load libiava through libjvm as it is a JNI library
30 if ((Handle = LibJvm.Instance.JVM_LoadLibrary(Path.Combine(JVM.Properties.HomePath, "bin", NativeLibrary.MapLibraryName("iava")))) == 0)
31 throw new InternalException("Could not load libiava.");
32 }
33
37 public nint Handle { get; private set; }
38
42 ~LibJava()
43 {
44 if (Environment.HasShutdownStarted == false)
45 {
46 if (Handle != 0)
47 {
48 var h = Handle;
49 Handle = 0;
50 LibJvm.Instance.JVM_UnloadLibrary(h);
51 }
52 }
53 }
54
55 }
56
57#endif
58
59}