summaryrefslogtreecommitdiffstats
path: root/make/joal-common-CustomJavaCode.java
blob: 436f4628b2cb214af850070b4bc3622d2fb552ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
static final DynamicLibraryBundle alDynamicLookupHelper;
private static final ALProcAddressTable alProcAddressTable;

static {
    alProcAddressTable = new ALProcAddressTable();
    if(null==alProcAddressTable) {
      throw new RuntimeException("Couldn't instantiate ALProcAddressTable");
    }

    alDynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DynamicLibraryBundle>() {
                                public DynamicLibraryBundle run() {
                                    return new DynamicLibraryBundle(new ALDynamicLibraryBundleInfo());
                                } } );

    if(null==alDynamicLookupHelper) {
      throw new RuntimeException("Null ALDynamicLookupHelper");
    }
    if(!alDynamicLookupHelper.isToolLibLoaded()) {
      throw new RuntimeException("Couln't load native AL library");
    }
    if(!alDynamicLookupHelper.isLibComplete()) {
      throw new RuntimeException("Couln't load native AL/JNI glue library");
    }
    alProcAddressTable.reset(alDynamicLookupHelper);
}

public static ALProcAddressTable getALProcAddressTable() { return alProcAddressTable; }

static long alGetProcAddress(long alGetProcAddressHandle, java.lang.String procname)
{
    if (alGetProcAddressHandle == 0) {
        throw new RuntimeException("Passed null pointer for method \"alGetProcAddress\"");
    }
    return dispatch_alGetProcAddressStatic(procname, alGetProcAddressHandle);
}

static native long dispatch_alGetProcAddressStatic(String fname, long procAddress);