Skip to content

Commit 0a6f71b

Browse files
committed
Register context as error handler
1 parent 65f2bcb commit 0a6f71b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/main/java/z3/Z3Wrapper.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public final class Z3Wrapper {
3030

3131
private static final String LIB_NAME = "scalaz3";
3232
private static final String LIBZ3_NAME = "libz3";
33+
private static final String Z3JAVA_NAME = "z3java";
3334
private static final String LIBZ3JAVA_NAME = "libz3java";
3435

3536
public static Object creation_lock = new Object();
@@ -91,9 +92,16 @@ private static void loadFromJar() {
9192
if (os != null && os.indexOf("Win") >= 0) {
9293
// Under windows, we first load libz3 explicitly, on which ScalaZ3 depends
9394
debug("Loading libz3");
94-
System.loadLibrary(LIBZ3_NAME);
95+
try { System.loadLibrary(LIBZ3_NAME); }
96+
catch (UnsatisfiedLinkError e) { debug("Failed to load " + LIBZ3_NAME); }
97+
98+
debug("Loading z3java");
99+
try { System.loadLibrary(Z3JAVA_NAME); }
100+
catch (UnsatisfiedLinkError e) { debug("Failed to load " + Z3JAVA_NAME); }
101+
95102
debug("Loading libz3java");
96-
System.loadLibrary(LIBZ3JAVA_NAME);
103+
try { System.loadLibrary(LIBZ3JAVA_NAME); }
104+
catch (UnsatisfiedLinkError e) { debug("Failed to load " + LIBZ3JAVA_NAME); }
97105
}
98106

99107
debug("Loading "+LIB_NAME);

src/main/scala/z3/scala/Z3Context.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ sealed class Z3Context(val config: Map[String, String]) {
2929
}
3030

3131
Z3Wrapper.registerContext(ptr, this)
32+
Native.setInternalErrorHandler(ptr)
3233

3334
val astQueue = new Z3RefCountQueue[Z3ASTLike]
3435
val astVectorQueue = new Z3RefCountQueue[Z3ASTVector]

0 commit comments

Comments
 (0)