diff options
author | Sven Gothel <[email protected]> | 2014-06-17 01:37:26 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-06-17 01:37:26 +0200 |
commit | 05d236515d37561a66b1e239984916e95a193cc8 (patch) | |
tree | 9f0acbe861f607ad423914591fd54a91bba53097 /make/config/joal-al-CustomJavaCode.java | |
parent | 0ad86c6c50a10bb3a53cac6fff1b857bae9c6192 (diff) |
Adapt to GlueGen commit c3054a01990e55ab35756ea23ab7d7c05f24dd37 (compount call-by-value extension)
Diffstat (limited to 'make/config/joal-al-CustomJavaCode.java')
-rw-r--r-- | make/config/joal-al-CustomJavaCode.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/make/config/joal-al-CustomJavaCode.java b/make/config/joal-al-CustomJavaCode.java new file mode 100644 index 0000000..551e51a --- /dev/null +++ b/make/config/joal-al-CustomJavaCode.java @@ -0,0 +1,41 @@ +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() { + final DynamicLibraryBundle bundle = new DynamicLibraryBundle(new ALDynamicLibraryBundleInfo()); + if(null==bundle) { + throw new RuntimeException("Null ALDynamicLookupHelper"); + } + if(!bundle.isToolLibLoaded()) { + throw new RuntimeException("Couln't load native AL library"); + } + if(!bundle.isLibComplete()) { + throw new RuntimeException("Couln't load native AL/JNI glue library"); + } + alProcAddressTable.reset(bundle); + if( !initializeImpl() ) { + throw new RuntimeException("Initialization failure"); + } + return bundle; + } } ); +} + +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); + |