summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-08-28 12:54:40 +0200
committerAraq <rumpf_a@web.de>2018-08-28 15:41:55 +0200
commita42150f9a878cb131dd79769cceeaa9deacee40f (patch)
tree6cdd6842cc64194094cb6abc3e9cc64c27e4bed1 /lib
parente02e057a706e6d3ec7948ef0c51509e033c4ec6b (diff)
downloadNim-a42150f9a878cb131dd79769cceeaa9deacee40f.tar.gz
make parseopt work with DLLs on Unix
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/parseopt.nim15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/pure/parseopt.nim b/lib/pure/parseopt.nim
index 3a79504db..70319ddf0 100644
--- a/lib/pure/parseopt.nim
+++ b/lib/pure/parseopt.nim
@@ -227,13 +227,14 @@ proc next*(p: var OptParser) {.rtl, extern: "npo$1".} =
     inc p.idx
     p.pos = 0
 
-proc cmdLineRest*(p: OptParser): TaintedString {.rtl, extern: "npo$1".} =
-  ## retrieves the rest of the command line that has not been parsed yet.
-  var res = ""
-  for i in p.idx..<p.cmds.len:
-    if i > p.idx: res.add ' '
-    res.add quote(p.cmds[i])
-  result = res.TaintedString
+when declared(os.paramCount):
+  proc cmdLineRest*(p: OptParser): TaintedString {.rtl, extern: "npo$1".} =
+    ## retrieves the rest of the command line that has not been parsed yet.
+    var res = ""
+    for i in p.idx..<p.cmds.len:
+      if i > p.idx: res.add ' '
+      res.add quote(p.cmds[i])
+    result = res.TaintedString
 
 iterator getopt*(p: var OptParser): tuple[kind: CmdLineKind, key, val: TaintedString] =
   ## This is an convenience iterator for iterating over the given OptParser object.