@static expr
is a way to only run expr
once;
for some sense of once.
but what sense of once is it?
Is it:
- once per time the package is installed?
- once per time the package is loaded?
- some other definition
The most common use is for OS checking: e.g.
ccall((@static Sys.iswindows() ? :_fopen : :fopen), ...)
I am wondering if I can use it to generate different code based on an environment variable: In particular JULIA_NUM_THREADS
.
This environment variable can change between runs of julia,
but if it changes during the session nothing will react to it.