Hacker News new | past | comments | ask | show | jobs | submit login

It may be different these days but it used to be the case that all kinds of things would start or require a GUI message loop behind the scenes. Most notoriously, COM STAs did, and all kinds of APIs would enter a COM "apartment" for you as part of their internal operation.

Also just look at the definition of the PEB and TEB. There's plenty of slots for GUI stuff that's just left empty for headless apps, but the space is still allocated. In the end Windows is GUI first with non GUI apps a second class citizen.

https://en.m.wikipedia.org/wiki/Win32_Thread_Information_Blo...

As you can see the primary OS per thread structure has fields like "GDI pen" and "GDI brush". There's no separation of GUI specific stuff from other kinds of apps. Even the EXE file format distinguishes between "an app that will open a window to run in the background" and "a command line app". There's no notion of a program that could be used as both a GUI or a command line app depending on how it's run.




> Most notoriously, COM STAs did, and all kinds of APIs would enter a COM "apartment" for you as part of their internal operation.

You make that sound like that was some kind of accidental leaky abstraction, when in fact it was by design. COM STAs were designed to work with GUI threads, full stop. If you aren't a GUI thread, you shouldn't be initializing yourself with STA COM.

> Also just look at the definition of the PEB and TEB. There's plenty of slots for GUI stuff that's just left empty for headless apps, but the space is still allocated.

I am perfectly fine with that, as it essentially removes thread-local GUI data from the application's TLS namespace. So a few extra pointers exist in the PEB and TEB, big deal.

> In the end Windows is GUI first with non GUI apps a second class citizen.

I don't really see how you can conclude that from STA COM and a couple of TLS slots reserved for the GUI.




Applications are open for YC Winter 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: