Skip to content

Commit

Permalink
Dynlib fix as suggested in status-im#31
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy Vlasov committed Oct 29, 2022
1 parent a26bfab commit 874c14f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions confutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -829,9 +829,21 @@ proc addConfigFile*(secondarySources: auto,
raise newException(ConfigurationError,
"Failed to read config file at '" & string(path) & "': " & 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 @@ -1079,7 +1091,7 @@ proc loadImpl[C, SecondarySources](

template load*(
Configuration: type,
cmdLine = commandLineParams(),
cmdLine = getCLIParams(),
version = "",
copyrightBanner = "",
printUsage = true,
Expand Down Expand Up @@ -1187,3 +1199,4 @@ func load*(f: TypedInputFile): f.ContentType =
mixin loadFile
loadFile(f.Format, f.string, f.ContentType)


0 comments on commit 874c14f

Please sign in to comment.