Skip to content

Commit 9ab928a

Browse files
CodaFiharlanhaskins
authored andcommitted
Run static constructors/destructors on init/deinit (#84)
1 parent a399453 commit 9ab928a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/LLVM/JIT.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public final class JIT {
5151
throw JITError.couldNotInitialize("JIT was NULL")
5252
}
5353
self.llvm = _jit
54+
LLVMRunStaticConstructors(self.llvm)
5455
}
5556

5657
/// Runs the specified function with the provided arguments by compiling
@@ -121,6 +122,10 @@ public final class JIT {
121122
buf.baseAddress, nil))
122123
}
123124
}
125+
126+
deinit {
127+
LLVMRunStaticDestructors(self.llvm)
128+
}
124129
}
125130

126131
/// Runs the provided block with the equivalent C strings copied from the

0 commit comments

Comments
 (0)