Thread overview
[Issue 24310] ImportC: varargs from Microsoft header incompatible with va_start
Jan 01
Dlang Bot
Jan 04
Dlang Bot
Jan 04
kinke
Jan 04
Dennis
Jan 04
kinke
January 01
https://issues.dlang.org/show_bug.cgi?id=24310

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #1 from Dlang Bot <dlang-bot@dlang.rocks> ---
@WalterBright updated dlang/dlang.org pull request #3752 "fix Issue 24312 - importC: Document workaround for using C symbols wh…" fixing this issue:

- fix Issue 24310 - importC: Document workaround for using C symbols which are also D keywords

https://github.com/dlang/dlang.org/pull/3752

--
January 01
https://issues.dlang.org/show_bug.cgi?id=24310

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
(In reply to Dlang Bot from comment #1)
> https://github.com/dlang/dlang.org/pull/3752

Ignore that. It was meant for another issue.

--
January 02
https://issues.dlang.org/show_bug.cgi?id=24310

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
Currently,

1. there is no va_start in importc.h

2. in __builtins.di there is:

    alias __builtin_va_start = imported!"core.stdc.stdarg".va_start;

3. in Microsoft's stdarg.h there is:

    #define va_start __crt_va_start

4. in core.stdc.stdarg there is:

    void va_start(T)(out va_list ap, ref T parmn);

va_start() is an intrinsic built in to dmd.

Is __va_start() a Microsoft intrinsic?

--
January 02
https://issues.dlang.org/show_bug.cgi?id=24310

--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> ---
I suspect it might work if we added to stdarg.d:

    void __va_start(T)(va_list* ap, ref T parmn)
    {
        va_start(*ap, parmn);
    }

and to __builtins.di:

    alias __va_start = imported!"core.stdc.stdarg".__va_start;

--
January 04
https://issues.dlang.org/show_bug.cgi?id=24310

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dlang.org pull request #3752 "fix Issue 24310 - importC: Document workaround for using C symbols wh…" was merged into master:

- 078629cbca561a697cb380481bcce6744c0a07ef by Walter Bright:
  fix Issue 24310 - importC: Document workaround for using C symbols which are
also D keywords

https://github.com/dlang/dlang.org/pull/3752

--
January 04
https://issues.dlang.org/show_bug.cgi?id=24310

kinke <kinke@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |kinke@gmx.net
         Resolution|FIXED                       |---

--
January 04
https://issues.dlang.org/show_bug.cgi?id=24310

--- Comment #6 from Dennis <dkorpel@live.nl> ---
Issue was linked to the wrong PR

--
January 04
https://issues.dlang.org/show_bug.cgi?id=24310

--- Comment #7 from kinke <kinke@gmx.net> ---
(In reply to Walter Bright from comment #4)
> I suspect it might work if we added to stdarg.d:
> 
>     void __va_start(T)(va_list* ap, ref T parmn)
>     {
>         va_start(*ap, parmn);
>     }
> 
> and to __builtins.di:
> 
>     alias __va_start = imported!"core.stdc.stdarg".__va_start;

I doubt it - this would probably need to be force-inlined at the AST level to work properly.

--