Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ytecer opened this issue Feb 10, 2021 · 6 comments
Closed

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

ytecer opened this issue Feb 10, 2021 · 6 comments
Labels
system:windows Affects only Windows

Comments

@ytecer
Copy link

ytecer commented Feb 10, 2021

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
@Keno Keno added the system:windows Affects only Windows label Feb 14, 2021
@Keno
Copy link
Member

Keno commented Feb 14, 2021

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

@ytecer
Copy link
Author

ytecer commented Feb 14, 2021

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
Copy link

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

@toivoh
Copy link
Contributor

toivoh commented Apr 10, 2021

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
Copy link
Contributor

toivoh commented Apr 10, 2021

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
Copy link
Member

vtjnash commented Sep 28, 2022

Duplicate of #42098, fixed by #42152

@vtjnash vtjnash closed this as completed Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
system:windows Affects only Windows
Projects
None yet
Development

No branches or pull requests

5 participants