From a4bdffd73a9d566f109e9f9c35b8a8d85eb9fd75 Mon Sep 17 00:00:00 2001 From: Oliver Schulz Date: Thu, 15 Jan 2026 10:25:28 +0100 Subject: [PATCH] Update juliac demo juliac requires an @main function now. --- juliac/hepexample.jl | 10 +++------- juliac/make.sh | 11 ++++++++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/juliac/hepexample.jl b/juliac/hepexample.jl index 8b2bad1..d9b1e27 100644 --- a/juliac/hepexample.jl +++ b/juliac/hepexample.jl @@ -1,5 +1,3 @@ -module RunHEPExample - using HEPExampleProject using Random @@ -22,7 +20,7 @@ function print_values(output::IO, evt::Event)::Nothing return print(output, weight) end -Base.@ccallable function main()::Cint +@main function main(args) n_events = 20 rng = Xoshiro(137) @@ -34,10 +32,8 @@ Base.@ccallable function main()::Cint println(Core.stdout) end - return zero(Cint) + return 0 end -end # module RunHEPExample - # # In Julia, test with -# RunHEPExample.main() +# julia> include("hepexample.jl"); main() diff --git a/juliac/make.sh b/juliac/make.sh index e6d3022..9e02469 100755 --- a/juliac/make.sh +++ b/juliac/make.sh @@ -5,11 +5,16 @@ set -e +julia -e 'exit(VERSION >= v"1.12" ? 0 : 1)' || ( + echo "ERROR: Need julia >= v1.12 for juliac support." >&2 + exit 1 +) + # Binaries generated by juliac may segfault if JULIA_CPU_TARGET is set: unset JULIA_CPU_TARGET -jlbindir=`julia-1.12 -e 'println(dirname(Sys.BINDIR))'` +jlbindir=`julia -e 'println(dirname(Sys.BINDIR))'` -julia-1.12 --project=. -e 'import Pkg; Pkg.instantiate()' +julia --project=. -e 'import Pkg; Pkg.instantiate()' -julia-1.12 --project=. "$jlbindir/share/julia/juliac.jl" --experimental --trim=unsafe-warn --output-exe hepexample hepexample.jl +julia --project=. "$jlbindir/share/julia/juliac/juliac.jl" --experimental --trim=unsafe-warn --output-exe hepexample hepexample.jl