Browse Source

Redo `runicc.jl` for julia v1.12.0-rc1

pull/160/head
Romeo Valentin 4 months ago
parent
commit
0da6d5abc6
  1. 23
      juliac/runicc.jl

23
juliac/runicc.jl

@ -1,22 +1,11 @@ @@ -1,22 +1,11 @@
module RunicC
using Runic: Runic
# Compileable main function corresponding to `int main(int argc, char** argv)`
Base.@ccallable function main(argc::Cint, argv::Ptr{Ptr{UInt8}})::Cint
# Load command line arguments. Note that the first argument is the
# executable name so we skip it.
args = Vector{String}(undef, argc - 1)
for i in 2:argc
argptr = unsafe_load(argv, i)
arg = unsafe_string(argptr)
args[i - 1] = arg
function @main(args::Vector{String})::Cint
if length(args) == 1
Runic.print_help()
return 0
else
return Runic.main(args[2: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

Loading…
Cancel
Save