From 24651b69ec5139835516fb3a73341b5295fc4fea Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Sun, 2 Apr 2017 18:35:59 -0400 Subject: [PATCH] Run static constructors/destructors on init/deinit --- Sources/LLVM/JIT.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/LLVM/JIT.swift b/Sources/LLVM/JIT.swift index cb7ef9c7..09153c43 100644 --- a/Sources/LLVM/JIT.swift +++ b/Sources/LLVM/JIT.swift @@ -51,6 +51,7 @@ public final class JIT { throw JITError.couldNotInitialize("JIT was NULL") } self.llvm = _jit + LLVMRunStaticConstructors(self.llvm) } /// Runs the specified function with the provided arguments by compiling @@ -121,6 +122,10 @@ public final class JIT { buf.baseAddress, nil)) } } + + deinit { + LLVMRunStaticDestructors(self.llvm) + } } /// Runs the provided block with the equivalent C strings copied from the