dhoegh / BuildExecutable.jl

Build a standalone executables from a Julia script
Other
156 stars 21 forks source link

ARGS in compiled code #7

Closed rofinn closed 8 years ago

rofinn commented 8 years ago

Sorry, if this is a dumb question, but is there any way to have the ARGS constant set at runtime rather than compile time? I have a script that takes cmd line args and when I compile my script my arguments are being ignored when I try to run it, I'm assuming because the ARGS constant is set at compile time and doesn't change at runtime?

dhoegh commented 8 years ago

It is not possible as the code is, but it can be made to do so. @KDr2 do you have any insights in how the cmd-arguments can be passed on from the c-main function to julia?

sfchen commented 8 years ago

I think the simplest method will work is to: convert char** argv to a Julia Array{UTF8String, 1}, and then pass it to Julia, along with argc

KDr2 commented 8 years ago

Yeah, I think that pass char** argv to julia's Base.ARGS as a Array{UTF8String, 1} works, I just proposed a PR: https://github.com/dhoegh/BuildExecutable.jl/pull/8 , Please have a try, review and test.

dhoegh commented 8 years ago

As #8 has been merged I will close this.

rofinn commented 8 years ago

FWIW, the update works perfectly :) Thanks folks!