Skip to content

v1.12, embedding: unable to access globals in used module without updating world age #58097

@Taaitaaiger

Description

@Taaitaaiger

The following code fails unless the commented line is enabled:

#include <julia.h>

JULIA_DEFINE_FAST_TLS

int main(int argc, char *argv[])
{
    jl_init();
    jl_value_t *dot = jl_get_global(jl_main_module, jl_symbol("dot"));
    assert(dot == NULL);

    jl_eval_string("using LinearAlgebra");
    
    // jl_current_task->world_age = jl_get_world_counter();
    dot = jl_get_global(jl_main_module, jl_symbol("dot"));
    assert(dot != NULL);

    jl_atexit_hook(0);

    return 0;
}

My understanding is that this fails because jl_eval_string calls jl_toplevel_eval_in, which reverts the update to the world age. jl_calling include has similar issues.

Metadata

Metadata

Assignees

Labels

regression 1.12Regression in the 1.12 release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions