aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2020-04-22 12:01:20 -0500
committerGanesh Viswanathan <dev@genotrance.com>2020-04-22 12:01:20 -0500
commitf17b958f47686f41a20045ea089295841a6845d6 (patch)
treef01483b19b6c35769915eb5c7ef21b2e611415b8
parentda6a4e30ab9c88748e54e4cf0bdae248c8750cdd (diff)
downloadnimterop-crash.tar.gz
nimterop-crash.zip
markAndSweep, removeStaticcrash
-rw-r--r--config.nims4
-rw-r--r--nimterop/getters.nim16
2 files changed, 3 insertions, 17 deletions
diff --git a/config.nims b/config.nims
index 6b475de..f5f7d21 100644
--- a/config.nims
+++ b/config.nims
@@ -5,8 +5,8 @@ else:
switch("gcc.linkerexe", "g++")
# Workaround for NilAccessError crash on Windows #98
-when defined(Windows):
- switch("gc", "markAndSweep")
+# Could also help for OSX/Linux crash
+switch("gc", "markAndSweep")
# Retain stackTrace for clear errors
switch("stackTrace", "on")
diff --git a/nimterop/getters.nim b/nimterop/getters.nim
index 88786ce..2d8d9bb 100644
--- a/nimterop/getters.nim
+++ b/nimterop/getters.nim
@@ -510,20 +510,6 @@ proc getNameInfo*(gState: State, node: TSNode, kind: NimSymKind, parent = ""):
proc getCurrentHeader*(fullpath: string): string =
("header" & fullpath.splitFile().name.multiReplace([(".", ""), ("-", "")]))
-proc removeStatic(content: string): string =
- ## Replace static function bodies with a semicolon and commented
- ## out body
- return content.replace(
- re"(?msU)static inline ([^)]+\))([^}]+\})",
- proc (m: RegexMatch, s: string): string =
- let funcDecl = s[m.group(0)[0]]
- let body = s[m.group(1)[0]].strip()
- result = ""
-
- result.add("$#;" % [funcDecl])
- result.add(body.replace(re"(?m)^(.*\n?)", "//$1"))
- )
-
proc getPreprocessor*(gState: State, fullpath: string): string =
var
cmts = if gState.nocomments: "" else: "-CC"
@@ -731,7 +717,7 @@ proc loadPlugin*(gState: State, sourcePath: string) =
pdll = sourcePath.dll
if not fileExists(pdll) or
sourcePath.getLastModificationTime() > pdll.getLastModificationTime():
- discard execAction(&"{gState.nim.sanitizePath} c --app:lib {sourcePath.sanitizePath}")
+ discard execAction(&"{gState.nim.sanitizePath} c --app:lib --gc:markAndSweep {sourcePath.sanitizePath}")
doAssert fileExists(pdll), "No plugin binary generated for " & sourcePath
let lib = loadLib(pdll)