Class RulesJni
cc_jni_library rule of
rules_jni.-
Method Summary
Modifier and TypeMethodDescriptionstatic PathextractLibrary(String name, Class<?> inSamePackageAs) Extracts a native library created with thecc_jni_libraryrule from the resource directory of the classinSamePackageAsto a temporary file.static PathextractLibrary(String name, String absolutePathToPackage) Loads a native library created with thecc_jni_libraryrule from the resource directory specified by the absolute pathabsolutePathToPackage.static voidloadLibrary(String name, Class<?> inSamePackageAs) Loads a native library created with thecc_jni_libraryrule from the resource directory of the classinSamePackageAs.static voidloadLibrary(String name, String absolutePathToPackage) Loads a native library created with thecc_jni_libraryrule from the resource directory specified by the absolute pathabsolutePathToPackage.
-
Method Details
-
loadLibrary
Loads a native library created with thecc_jni_libraryrule from the resource directory of the classinSamePackageAs.The correct version of the native library for the current OS and CPU architecture is chosen automatically.
All temporary files created during the extraction of the native library are cleaned up at JVM exit.
- Parameters:
name- the name of thecc_jni_librarytarget that generates the native library to be loaded.inSamePackageAs- a class that is contained in the same Java (or Bazel) package as the native library.- Throws:
NullPointerException- ifnameorinSamePackageAsisnull.SecurityException- if a security manager exists and its checkLink method doesn't allow loading of the specified dynamic library.UnsatisfiedLinkError- if a version of the library for the current OS and CPU architecture could not be found in the resource directory corresponding toinSamePackageAsor extracting the library failed.
-
loadLibrary
Loads a native library created with thecc_jni_libraryrule from the resource directory specified by the absolute pathabsolutePathToPackage.The correct version of the native library for the current OS and CPU architecture is chosen automatically.
All temporary files created during the extraction of the native library are cleaned up at JVM exit.
- Parameters:
name- the name of thecc_jni_librarytarget that generates the native library to be loaded.absolutePathToPackage- a class that is contained in the same Java (or Bazel) package as the native library.- Throws:
NullPointerException- ifnameorabsolutePathToPackageisnull.SecurityException- if a security manager exists and its checkLink method doesn't allow loading of the specified dynamic library.UnsatisfiedLinkError- if a version of the library for the current OS and CPU architecture could not be found in the specified resource directory or extracting the library failed.
-
extractLibrary
Extracts a native library created with thecc_jni_libraryrule from the resource directory of the classinSamePackageAsto a temporary file.The correct version of the native library for the current OS and CPU architecture is chosen automatically.
All temporary files created during the extraction of the native library are cleaned up at JVM exit.
- Parameters:
name- the name of thecc_jni_librarytarget that generates the native library to be loaded.inSamePackageAs- a class that is contained in the same Java (or Bazel) package as the native library.- Throws:
NullPointerException- ifnameorinSamePackageAsisnull.SecurityException- if a security manager exists and its checkLink method doesn't allow loading of the specified dynamic library.UnsatisfiedLinkError- if a version of the library for the current OS and CPU architecture could not be found in the resource directory corresponding toinSamePackageAs.IOException- if extracting the library failed.
-
extractLibrary
Loads a native library created with thecc_jni_libraryrule from the resource directory specified by the absolute pathabsolutePathToPackage.The correct version of the native library for the current OS and CPU architecture is chosen automatically.
All temporary files created during the extraction of the native library are cleaned up at JVM exit.
- Parameters:
name- the name of thecc_jni_librarytarget that generates the native library to be loaded.absolutePathToPackage- a class that is contained in the same Java (or Bazel) package as the native library.- Throws:
NullPointerException- ifnameorabsolutePathToPackageisnull.SecurityException- if a security manager exists and its checkLink method doesn't allow loading of the specified dynamic library.UnsatisfiedLinkError- if a version of the library for the current OS and CPU architecture could not be found in the specified resource directory or extracting the library failed.IOException- if extracting the library failed.
-