Skip to content

I get the error 'jl_atomic_load_relaxed: identifier not found.' #39595

@ytecer

Description

@ytecer

I am using Julia 1.6.0-rc1. As stated at https://docs.julialang.org/en/v1/manual/embedding/, I made the necessary settings in Visual Studio 2019, but when I compile the code, I get the error 'jl_atomic_load_relaxed: identifier not found.'

Code:

#include <uv.h>
#include <Windows.h>
#include <julia.h>

int main(int argc, char* argv[])
{
    jl_init();
    jl_eval_string("print(sqrt(2.0))");
    jl_atexit_hook(0);
    return 0;
}

Error:

'jl_atomic_load_relaxed': identifier not found    julia.h     880
'jl_atomic_load_relaxed': identifier not found    julia.h     924
'jl_atomic_load_relaxed': identifier not found    locks.h   24
'jl_atomic_load_relaxed': identifier not found    locks.h   40

Activity

Keno

Keno commented on Feb 14, 2021

@Keno
Member

Looks like the MSVC versions of these are missing from atomics.h

ytecer

ytecer commented on Feb 14, 2021

@ytecer
Author

Thank you for your answer. I think the following lines should be added to Atomics.h file.

template<typename T>
static inline T jl_atomic_load_relaxed(volatile T *obj)
{
 #code....
 #code....
}
balenamiaa

balenamiaa commented on Apr 4, 2021

@balenamiaa

Is there a reason compiler builtins are used instead of a higher level abstraction like stdatomic.h or mintomic?

toivoh

toivoh commented on Apr 10, 2021

@toivoh
Contributor

I got it to work with

template<typename T>
static inline T jl_atomic_load_relaxed(volatile T *obj)
{
    return jl_atomic_load_acquire(obj);
}

I guess this is not ideal, since jl_atomic_load_acquire should be stronger than jl_atomic_load_relaxed, but at least that means that is should work.

Some googling led me to believe that InterlockedOrNoFence might be used instead in MSVC, but I'm not sure enough about the details to try it myself.

toivoh

toivoh commented on Apr 10, 2021

@toivoh
Contributor

I also had to handle #34201 to get embedding to work (tried with Julia 1.6.0 in MSVC 2017), described what I did in that issue.

vtjnash

vtjnash commented on Sep 28, 2022

@vtjnash
SponsorMember

Duplicate of #42098, fixed by #42152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @vtjnash@Keno@toivoh@balenamiaa@ytecer

        Issue actions

          I get the error 'jl_atomic_load_relaxed: identifier not found.' · Issue #39595 · JuliaLang/julia