Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/java/org/bitcoin/Secp256k1Context.java
Show All 22 Lines | |||||
public class Secp256k1Context { | public class Secp256k1Context { | ||||
private static final boolean enabled; //true if the library is loaded | private static final boolean enabled; //true if the library is loaded | ||||
private static final long context; //ref to pointer to context obj | private static final long context; //ref to pointer to context obj | ||||
static { //static initializer | static { //static initializer | ||||
boolean isEnabled = true; | boolean isEnabled = true; | ||||
long contextRef = -1; | long contextRef = -1; | ||||
try { | try { | ||||
System.loadLibrary("secp256k1"); | System.loadLibrary("secp256k1_jni"); | ||||
contextRef = secp256k1_init_context(); | contextRef = secp256k1_init_context(); | ||||
} catch (UnsatisfiedLinkError e) { | } catch (UnsatisfiedLinkError e) { | ||||
System.out.println("UnsatisfiedLinkError: " + e.toString()); | System.out.println("UnsatisfiedLinkError: " + e.toString()); | ||||
isEnabled = false; | isEnabled = false; | ||||
} | } | ||||
enabled = isEnabled; | enabled = isEnabled; | ||||
context = contextRef; | context = contextRef; | ||||
} | } | ||||
Show All 12 Lines |