Recent

Author Topic: [SOLVED] Problem running external program under Linux  (Read 13200 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6646
Re: Problem running external program under Linux
« Reply #30 on: July 30, 2021, 09:55:31 am »
The header of PE/COFF files contains a field that decides the subsystem of the executable (in this case GUI vs. CUI, there are also other values that are not important for this).

Yes, that was one of the things I was thinking about. It could be argued that Unix-style ELF etc. are deficient in their lack of this, and that their ability to check during startup is no substitute for telling the OS what resources might be needed before attempting to bring anything into memory.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1088
  • Professional amateur ;-P
Re: Problem running external program under Linux
« Reply #31 on: July 30, 2021, 07:21:03 pm »
Hey PascalDragon,

This is not quite correct. Windows evolved from DOS where the only possibility were console applications.

I was being a bit over-simplistic in my, wrongly, generalization of the issue.
I'm that old that I should not fall into these traps of doing so much generalization, but hey, here you go, me messing it up again :)

The header of PE/COFF files contains a field that decides the subsystem of the executable (in this case GUI vs. CUI, there are also other values that are not important for this). Applications that have the subsystem type CUI require a terminal, but not a console window, cause it's perfectly fine to execute console applications in e.g. a SSH session (when you connect to a Windows using SSH) or e.g. on the Windows IoT core variant of devices where you have either WinRT style apps or console applications. (Also when starting a process it can be requested to hide that window upon start)

TL;DR: If you start a CUI application from a process that does not have a terminal associated then Windows will automatically spawn a console window, but if a terminal is associated it will continue to use that.

I was not aware of that, at all.

As per usual, many thanks PascalDragon for the trove on invaluable info!!!

On a side note, where do Windows Services fall in all this, cuz they're the only ones, well that I know of, that don't need a Window associated with, right?

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

 

TinyPortal © 2005-2018