summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/JOCLJNILibLoader.java
blob: c8a052104f4f8004bdbd8bd5f2553d61bca6a115 (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
package com.jogamp.opencl;

import java.security.PrivilegedAction;
import com.jogamp.common.jvm.JNILibLoaderBase;
import com.jogamp.common.os.NativeLibrary;

import static java.security.AccessController.*;

/**
 * Responsible for JOCL lib loading.
 * @author Michael Bien
 */
class JOCLJNILibLoader extends JNILibLoaderBase {

    /**
     * Loads the native binding and returns the OpenCL library for dynamic linking.
     */
    static NativeLibrary loadJOCL() {

        return doPrivileged(new PrivilegedAction<NativeLibrary>() {
            public NativeLibrary run() {
                loadLibrary("jocl", null, true);
                return NativeLibrary.open("OpenCL", JOCLJNILibLoader.class.getClassLoader());
            }
        });
    }
}