When does Delphi use System.IsConsole?

According to System.pas, it is documented as True if compiled as console app . There is also a purpose in System.pas

 {$IFDEF LINUX} IsConsole := True; ... 

I have a strange problem when an application starts from a Delphi application using ShellExecute and then runs into this code, throwing an (unexpected) exception

  if System.IsConsole then raise Exception.Create(Msg) 

The application is not compiled using Project/Options/Linking/Generate console application . What else can set IsConsole to true?


Note that in Delphi XE2 , OSX applications cannot use this variable because it is always true. See QC Entry 98956 and Why does my OSX FireMonkey app think it's a console app?

+6
source share
1 answer

Found: the executable was created using dcc32.exe and the dpr / cfg file, cfg contains the line

 -cc 

which creates a console application.

In the Delphi 2009 Enterprise IDE, this option is not displayed in the Project/Options/Linking/Generate console application dialog box. The app was ported from an older version of Delphi and maybe something went wrong over the years.

+5
source

Source: https://habr.com/ru/post/894719/


All Articles