summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/jogamp/opencl/CLPlatform.java18
-rw-r--r--src/com/jogamp/opencl/JOCLJNILibLoader.java5
2 files changed, 17 insertions, 6 deletions
diff --git a/src/com/jogamp/opencl/CLPlatform.java b/src/com/jogamp/opencl/CLPlatform.java
index c12fbd47..70b27a0a 100644
--- a/src/com/jogamp/opencl/CLPlatform.java
+++ b/src/com/jogamp/opencl/CLPlatform.java
@@ -76,11 +76,14 @@ public final class CLPlatform {
doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
- NativeLibrary lib = JOCLJNILibLoader.loadJOCL();
+ NativeLibrary libOpenCL = JOCLJNILibLoader.loadOpenCL();
+ if(libOpenCL == null) {
+ throw new JogampRuntimeException("OpenCL library not found.");
+ }
- //eagerly init funciton to query extension addresses (used in reset())
- table.initEntry("clGetExtensionFunctionAddressImpl", lib);
- table.reset(lib);
+ //eagerly init function to query extension addresses (used in reset())
+ table.initEntry("clGetExtensionFunctionAddressImpl", libOpenCL);
+ table.reset(libOpenCL);
return null;
}
});
@@ -99,6 +102,13 @@ public final class CLPlatform {
}
/**
+ * Eagerly initializes JOCL. Subsequent calls do nothing.
+ */
+ public static void initialize() throws JogampRuntimeException {
+ //see static initializer
+ }
+
+ /**
* Returns the default OpenCL platform or null when no platform found.
*/
public static CLPlatform getDefault() {
diff --git a/src/com/jogamp/opencl/JOCLJNILibLoader.java b/src/com/jogamp/opencl/JOCLJNILibLoader.java
index 61436aa5..5e2eae37 100644
--- a/src/com/jogamp/opencl/JOCLJNILibLoader.java
+++ b/src/com/jogamp/opencl/JOCLJNILibLoader.java
@@ -12,9 +12,10 @@ class JOCLJNILibLoader extends JNILibLoaderBase {
/**
* Loads the native binding and returns the OpenCL library for dynamic linking.
+ * @return Returns libOpenCL represented as NativeLibrary.
*/
- static NativeLibrary loadJOCL() {
- loadLibrary("jocl", null, true);
+ static NativeLibrary loadOpenCL() {
+ loadLibrary("jocl", null, false);
return NativeLibrary.open("OpenCL", JOCLJNILibLoader.class.getClassLoader());
}
}