Bug 23894 – ImportC: _InterlockedExchangeAdd and a ton of other VC intrinsics are not recognized

Status
NEW
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2023-05-05T19:58:20Z
Last change time
2024-12-13T19:28:36Z
Keywords
ImportC
Assigned to
No Owner
Creator
Max Samukha
Moved to GitHub: dmd#20270 →

Attachments

IDFilenameSummaryContent-TypeSize
1878windows.cVC intrinsics referenced by windows.htext/x-csrc3638

Comments

Comment #0 by maxsamukha — 2023-05-05T19:58:20Z
"Windows.h" intrinsics: main.obj : error LNK2019: unresolved external symbol _InterlockedExchangeAdd referenced in function _InlineInterlockedAdd main.obj : error LNK2019: unresolved external symbol _InterlockedExchangeAdd64 referenced in function _InlineInterlockedAdd64 main.obj : error LNK2019: unresolved external symbol _mul128 referenced in function MultiplyExtract128 main.obj : error LNK2019: unresolved external symbol __shiftright128 referenced in function MultiplyExtract128 main.obj : error LNK2019: unresolved external symbol _umul128 referenced in function UnsignedMultiplyExtract128 main.obj : error LNK2019: unresolved external symbol _ReadWriteBarrier referenced in function BarrierAfterRead main.obj : error LNK2019: unresolved external symbol __stosb referenced in function RtlSecureZeroMemory main.obj : error LNK2019: unresolved external symbol __readgsqword referenced in function NtCurrentTeb Fun!
Comment #1 by bugzilla — 2023-05-11T06:01:59Z
ImportC doesn't support gcc's inline assembler, either. Is the use of these intrinsics blockable with some macro?
Comment #2 by maxsamukha — 2023-05-11T17:12:13Z
(In reply to Walter Bright from comment #1) > Is the use of these intrinsics blockable with some macro? I don't think so. They are not conditioned on a macro that could be simply (un)defined (if that's what you meant).
Comment #3 by bugzilla — 2023-05-29T07:10:30Z
Could you please post the section of code in the windows.h you have?
Comment #4 by maxsamukha — 2023-06-03T06:53:11Z
Created attachment 1878 VC intrinsics referenced by windows.h
Comment #5 by maxsamukha — 2023-06-03T06:53:58Z
(In reply to Walter Bright from comment #3) > Could you please post the section of code in the windows.h you have? Please see an isolated test case in the attachment.
Comment #6 by dfj1esp02 — 2023-12-01T10:26:40Z
Another problem is #define GENERIC_READ (0x80000000L) these are interpreted as helper macros due to parentheses and skipped.
Comment #7 by bugzilla — 2023-12-02T02:27:35Z
(In reply to anonymous4 from comment #6) > Another problem is > > #define GENERIC_READ (0x80000000L) > > these are interpreted as helper macros due to parentheses and skipped. This PR should resolve that problem. https://github.com/dlang/dmd/pull/15871
Comment #8 by sturtivant — 2024-03-11T05:49:19Z
Here's a workaround. https://forum.dlang.org/post/[email protected] There's a list of all x64 MSVC intrinsics at the included link with prototypes with named parameters.
Comment #9 by robert.schadek — 2024-12-13T19:28:36Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20270 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB