Bug 24509 – importC cannot handle _stdcall Function Calling Convention with single heading underscore
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2024-04-16T12:57:22Z
Last change time
2024-04-23T14:24:17Z
Keywords
pull
Assigned to
No Owner
Creator
Ferhat Kurtulmuş
Comments
Comment #0 by aferust — 2024-04-16T12:57:22Z
In Windows programming, the stdcall calling convention is usually specified using the __stdcall keyword or macro. The import c documentation also lists __stdcall calling convention with double underscores. However, there are some occurrences in c library headers using single underscores. For instance, Microsoft's onnx runtime [1]. This kind of usage is not handled with importc. Importc yields a syntax error for these situations, such as:
onnxruntime_c_api.h(288,25): Error: expected identifier for declarator
onnxruntime_c_api.h(288,25): Error: `;` or `,` expected
1: https://github.com/microsoft/onnxruntime/blob/08d208b969fec6e7f6505f4f468eea0d6a9031c2/include/onnxruntime/core/session/onnxruntime_c_api.h#L86