Hi,
is there a way to access the command line (in a macro) that was used to compile the program ?
Since I am only interested in the defined params, is there a way to see all the defines at compile time in order to iterate over them ?
thanks, Adrian.
What @def said.
Being curious how to add the command line as information to an executable I quickly came up with this:
# file: compiled_with.nims
#
# proof of concept for embedding the command line into the executable
var cmdline=""
for i in 0..paramCount():
cmdline.add paramStr(i)
cmdline.add ' '
# no other way to "share data" with the compiler?
exec("echo '" & cmdline & "' > cmdline.tmp") # no write file for NimScript?
setCommand("c")
# file: compiled_with.nim
#
# just a prove of concept! will break easily :)
const cmdline = staticRead("cmdline.tmp")
echo "I was compiled with: ", cmdline
Thats pretty ugly but "works" :)