mirror of https://github.com/fredrikekre/Runic.jl
1 changed files with 6 additions and 17 deletions
@ -1,22 +1,11 @@ |
|||||||
module RunicC |
|
||||||
|
|
||||||
using Runic: Runic |
using Runic: Runic |
||||||
|
|
||||||
# Compileable main function corresponding to `int main(int argc, char** argv)` |
# Compileable main function corresponding to `int main(int argc, char** argv)` |
||||||
Base.@ccallable function main(argc::Cint, argv::Ptr{Ptr{UInt8}})::Cint |
function @main(args::Vector{String})::Cint |
||||||
# Load command line arguments. Note that the first argument is the |
if length(args) == 1 |
||||||
# executable name so we skip it. |
Runic.print_help() |
||||||
args = Vector{String}(undef, argc - 1) |
return 0 |
||||||
for i in 2:argc |
else |
||||||
argptr = unsafe_load(argv, i) |
return Runic.main(args[2:end]) |
||||||
arg = unsafe_string(argptr) |
|
||||||
args[i - 1] = arg |
|
||||||
end |
end |
||||||
# Call Runic's main function |
|
||||||
return Runic.main(args) |
|
||||||
end |
|
||||||
|
|
||||||
# Tell juliac about the main entrypoint |
|
||||||
Base.Experimental.entrypoint(main, (Cint, Ptr{Ptr{UInt8}})) |
|
||||||
|
|
||||||
end |
end |
||||||
|
|||||||
Loading…
Reference in new issue