[Issue 24094] importC __declspec issues

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 25 01:43:26 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=24094

--- Comment #2 from Michael Barth <spirrwell at yahoo.com> ---
(In reply to Walter Bright from comment #1)
> I tried the following:
> 
> ------------ test.c -----------
> __declspec(allocator) __declspec(restrict)
>  void* __cdecl _calloc_base(int, int);
> -------------------------------
> 
> and it compiled without error. Can you perhaps try your code with the latest
> compiler? I note that __declspec(restrict) was a newer addition to dmd.

Hm, my bad. I guess I was literally just a few versions behind. It does compile
with the latest DMD. It looks like it also compiles with the latest beta
version of LDC2 as well.

There is one more __declspec issue I've come across that is still present as of
DMD v2.105.0.

Error: found `__declspec` instead of statement

This error seems to happen with the following code:

void fun() {
        __declspec(align(16)) short data[64];
}

This does not happen if the variable is in global scope or part of a struct. As
far as I've tested, it only occurs if the variable is declared inside a
function body.

--


More information about the Digitalmars-d-bugs mailing list