Skip to content

v1.12-rc1, embedding: A new constant only becomes visible if it has never been looked up #59184

@Taaitaaiger

Description

@Taaitaaiger

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    embeddingEmbedding Julia using the C API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions