The following code succeeds, unless the commented lines are uncommented:
#include <julia.h>
JULIA_DEFINE_FAST_TLS
int main(int argc, char *argv[])
{
jl_init();
jl_sym_t *var_name = jl_symbol("FOO");
jl_value_t *global;
// global = jl_get_global(jl_main_module, var_name);
// assert(global == NULL);
jl_set_const(jl_main_module, var_name, jl_true);
global = jl_get_global(jl_main_module, var_name);
assert(global == jl_true);
jl_atexit_hook(0);
return 0;
}
Tested on Ubuntu 24.04 with GCC 13