summary refs log tree commit diff stats
path: root/compiler/options.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-04-08 16:38:49 +0200
committerAraq <rumpf_a@web.de>2013-04-08 16:38:49 +0200
commit5893a9195c10181392262bf1a541737c2e2a142f (patch)
tree73f8fd3d0766eaeb839b642c210fcfa4a23a39dd /compiler/options.nim
parentc4edcf3ea2fef970c3528f74cf3abb988a69e0e2 (diff)
downloadNim-5893a9195c10181392262bf1a541737c2e2a142f.tar.gz
implemented --dynlibOverride option for static linking of 'dynlib'
Diffstat (limited to 'compiler/options.nim')
-rw-r--r--compiler/options.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/options.nim b/compiler/options.nim
index ad7c834dc..b38263ec5 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -124,6 +124,7 @@ const
 # additional configuration variables:
 var
   gConfigVars* = newStringTable(modeStyleInsensitive)
+  gDllOverrides = newStringtable(modeCaseInsensitive)
   libpath* = ""
   gProjectName* = "" # holds a name like 'nimrod'
   gProjectPath* = "" # holds a path like /home/alice/projects/nimrod/compiler/
@@ -256,6 +257,20 @@ proc libCandidates*(s: string, dest: var seq[string]) =
   else: 
     add(dest, s)
 
+proc canonDynlibName(s: string): string =
+  let start = if s.startsWith("lib"): 3 else: 0
+  let ende = strutils.find(s, {'(', ')', '.'})
+  if ende >= 0:
+    result = s.substr(start, ende-1)
+  else:
+    result = s.substr(start)
+
+proc inclDynlibOverride*(lib: string) =
+  gDllOverrides[lib.canonDynlibName] = "true"
+
+proc isDynlibOverride*(lib: string): bool =
+  result = gDllOverrides.hasKey(lib.canonDynlibName)
+
 proc binaryStrSearch*(x: openarray[string], y: string): int = 
   var a = 0
   var b = len(x) - 1