Skip to content

Commit

Permalink
Dynlib fix as suggested in #31
Browse files Browse the repository at this point in the history
  • Loading branch information
vitvly committed Jan 25, 2024
1 parent 7568f1b commit 416508c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions confutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -884,9 +884,21 @@ func constructEnvKey*(prefix: string, key: string): string {.raises: [].} =
except ValueError as err:
raiseAssert "strformat.`&` failed: " & err.msg

var getCLIParams*: proc(): seq[TaintedString]

# On Posix there is no portable way to get the command
# line from a DLL and thus the proc isn't defined in this environment.
# See https://nim-lang.org/docs/os.html#commandLineParams
when declared(paramCount):
getCLIParams = commandLineParams
else:
getCLIParams = proc(): seq[TaintedString] =
var emptyTaintedSeq: seq[TaintedString]
return emptyTaintedSeq

proc loadImpl[C, SecondarySources](
Configuration: typedesc[C],
cmdLine = commandLineParams(),
cmdLine = getCLIParams(),
version = "",
copyrightBanner = "",
printUsage = true,
Expand Down Expand Up @@ -1168,7 +1180,7 @@ proc loadImpl[C, SecondarySources](

template load*(
Configuration: type,
cmdLine = commandLineParams(),
cmdLine = getCLIParams(),
version = "",
copyrightBanner = "",
printUsage = true,
Expand Down

0 comments on commit 416508c

Please sign in to comment.