Thread overview
[Issue 19933] MSVC: Undefined std{in,out,err} with -betterC
Jan 10, 2021
kinke
Jan 10, 2021
kinke
Jan 10, 2021
kinke
Jan 10, 2021
kinke
Jan 11, 2021
Dennis
Feb 26, 2021
ryuukk_
Feb 26, 2021
ryuukk_
Feb 26, 2021
ryuukk_
Feb 12, 2022
Dlang Bot
Feb 14, 2022
Dlang Bot
January 10, 2021
https://issues.dlang.org/show_bug.cgi?id=19933

kinke <kinke@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke@gmx.net
            Summary|Win10 stdout link error?    |MSVC: Undefined
                   |                            |std{in,out,err} with
                   |                            |-betterC

--
January 10, 2021
https://issues.dlang.org/show_bug.cgi?id=19933

--- Comment #1 from kinke <kinke@gmx.net> ---
Quoting myself from https://github.com/ldc-developers/ldc/issues/3640#issuecomment-757464048:

The MSVC runtime doesn't feature these symbols; MS defines them as macros, whereas druntime defines and sets them at startup for convenience. [And druntime of course isn't linked with -betterC.]

--
January 10, 2021
https://issues.dlang.org/show_bug.cgi?id=19933

kinke <kinke@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86                         |All

--
January 10, 2021
https://issues.dlang.org/show_bug.cgi?id=19933

--- Comment #2 from kinke <kinke@gmx.net> ---
Just noticed that the OP hasn't used -betterC, but a C main, thus skipping the druntime initialization (incl. setting std{in,out,err}). With LDC v1.25, there's no linker error anymore, but the expected segfault as with DMD.

--
January 11, 2021
https://issues.dlang.org/show_bug.cgi?id=19933

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |DragonDePlatino@gmail.com

--- Comment #3 from Dennis <dkorpel@live.nl> ---
*** Issue 20532 has been marked as a duplicate of this issue. ***

--
February 26, 2021
https://issues.dlang.org/show_bug.cgi?id=19933

ryuukk_ <ryuukk.dev@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ryuukk.dev@gmail.com

--- Comment #4 from ryuukk_ <ryuukk.dev@gmail.com> ---
I just got hit by this, using -betterC

There are no errors, it just crash

The solution is to init windows runtime, but how to do that?

Shouldn't the solution be simpler? the experience as a result is very poor

--
February 26, 2021
https://issues.dlang.org/show_bug.cgi?id=19933

--- Comment #5 from ryuukk_ <ryuukk.dev@gmail.com> ---
I feel like the "Important" should be changed since it just crashes without any hints on how to solve the issue

--
February 26, 2021
https://issues.dlang.org/show_bug.cgi?id=19933

--- Comment #6 from ryuukk_ <ryuukk.dev@gmail.com> ---
Could https://github.com/dlang/druntime/blob/master/src/rt/msvc.d be moved to src/core?

So everyone could just call: init_msvc()

--
February 12, 2022
https://issues.dlang.org/show_bug.cgi?id=19933

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

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

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
@rainers created dlang/druntime pull request #3740 "fix issue 19933 and 18816: MSVC: Undefined std{in,out,err} with -betterC" fixing this issue:

- fix issue 19933 and 18816: MSVC: Undefined std{in,out,err} with -betterC

  moved C runtime check into template function

https://github.com/dlang/druntime/pull/3740

--
February 14, 2022
https://issues.dlang.org/show_bug.cgi?id=19933

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

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

--- Comment #8 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/druntime pull request #3740 "fix issue 19933 and 18816: MSVC: Undefined std{in,out,err} with -betterC" was merged into master:

- e7e6800babed4ff51b6c3b57dfa7e54cb76247f7 by Rainer Schuetze:
  fix issue 19933 and 18816: MSVC: Undefined std{in,out,err} with -betterC

  made stdin/out/err template function return value

https://github.com/dlang/druntime/pull/3740

--