www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - importC Error: undefined identifier `__atomic_thread_fence`

reply mw <mingwu gmail.com> writes:
Looks like `__atomic_thread_fence` is a GCC built-in function, so 
how to make importC recognize it?

Thanks.
Jun 21
parent Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
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
Jun 23