importC Error: undefined identifier `__atomic_thread_fence`

Jonathan M Davis newsgroup.d at jmdavisprog.com
Sun Jun 23 10:54:30 UTC 2024


On Friday, June 21, 2024 12:39:44 PM MDT mw via Digitalmars-d-learn wrote:
> Looks like `__atomic_thread_fence` is a GCC built-in function, so
> how to make importC recognize it?

dmd cannot handle it. gcc or ldc might, but dmd generally needs standard C
code. Stuff like gcc built-ins basically has to be removed from the file
(either literally or via a #define). Unfortunately, since I haven't really
done anything with importC, I can't give good info on how to do that
properly (outside of simply removing it from the file).

Looking over

https://dlang.org/spec/importc.html

this section might be useful:

https://dlang.org/spec/importc.html#_builtins

So, you can probably edit that file to make it work, though what you should
probably do is open a bug report for it - https://issues.dlang.org/  - and
if the correct solution is indeed to edit that file, then that will
hopefully lead to the file being updated (and if you're feeling particularly
motivated, you can always open a pull request -
https://github.com/dlang/dmd/).

- Jonathan M Davis





More information about the Digitalmars-d-learn mailing list