Skip to content

Commit a4bdffd

Browse files
committed
Update juliac demo
juliac requires an @main function now.
1 parent 19f001e commit a4bdffd

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

juliac/hepexample.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
module RunHEPExample
2-
31
using HEPExampleProject
42
using Random
53

@@ -22,7 +20,7 @@ function print_values(output::IO, evt::Event)::Nothing
2220
return print(output, weight)
2321
end
2422

25-
Base.@ccallable function main()::Cint
23+
@main function main(args)
2624
n_events = 20
2725

2826
rng = Xoshiro(137)
@@ -34,10 +32,8 @@ Base.@ccallable function main()::Cint
3432
println(Core.stdout)
3533
end
3634

37-
return zero(Cint)
35+
return 0
3836
end
3937

40-
end # module RunHEPExample
41-
4238
# # In Julia, test with
43-
# RunHEPExample.main()
39+
# julia> include("hepexample.jl"); main()

juliac/make.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55

66
set -e
77

8+
julia -e 'exit(VERSION >= v"1.12" ? 0 : 1)' || (
9+
echo "ERROR: Need julia >= v1.12 for juliac support." >&2
10+
exit 1
11+
)
12+
813
# Binaries generated by juliac may segfault if JULIA_CPU_TARGET is set:
914
unset JULIA_CPU_TARGET
1015

11-
jlbindir=`julia-1.12 -e 'println(dirname(Sys.BINDIR))'`
16+
jlbindir=`julia -e 'println(dirname(Sys.BINDIR))'`
1217

13-
julia-1.12 --project=. -e 'import Pkg; Pkg.instantiate()'
18+
julia --project=. -e 'import Pkg; Pkg.instantiate()'
1419

15-
julia-1.12 --project=. "$jlbindir/share/julia/juliac.jl" --experimental --trim=unsafe-warn --output-exe hepexample hepexample.jl
20+
julia --project=. "$jlbindir/share/julia/juliac/juliac.jl" --experimental --trim=unsafe-warn --output-exe hepexample hepexample.jl

0 commit comments

Comments
 (0)