Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-07

lazarus crash at start

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jesus Reyes

Trying to find why lazarus crashes at start in win98 I found a courious problem, global variable IsConsole is true when it should be false as lazarus is built as a gui application.

Digging I found that IsConsole is set in two functions in wprt0.as: _mainCRTStartup sets to true and _WinMainCRTStartup sets to False, this cause a wrong setup of standard Output that DebugLn (lclprocs.pas) use to emit debug messages.

It seems that this functions are 'used' in the linker script, for example ld .--verbose shows that by default a ENTRY(_mainCRTStartup) it's used. I looked into the generated lazarus link.res file and didn't find a ENTRY section so I guess it uses the default and that's why even when lazarus is a gui app, it's linked as a console app.

To demostrate this I modified the link.res script to inculde ENTRY(_WinMainCRTStartup) section and then linked, the resulting lazarus.exe file now behaves as a gui app and won't seems that WriteResponseFile lacks the code to add the ENTRY section to the link.res script but I don't know if it's supposed to be there or should it be in another stage, any comments?

Jesus Reyes A.

__________________________________________________ Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! Regístrate ya - http://correo.yahoo.com.mx/

Peter Vreman
to Jesus Reyes
you wrote 22 lines
Trying to find why lazarus crashes at start in win98 I found a courious problem, global variable IsConsole is true when it should be false as lazarus is built as a gui application. Digging I found that IsConsole is set in two functions in wprt0.as: _mainCRTStartup sets to true and _WinMainCRTStartup sets to False, this cause a wrong setup of standard Output that DebugLn (lclprocs.pas) use to emit debug messages. It seems that this functions are 'used' in the linker script, for example ld .--verbose shows that by default a ENTRY(_mainCRTStartup) it's used. I looked into the generated lazarus link.res file and didn't find a ENTRY section so I guess it uses the default and that's why even when lazarus is a gui app, it's linked as a console app. To demostrate this I modified the link.res script to inculde ENTRY(_WinMainCRTStartup) section and then linked, the resulting lazarus.exe file now behaves as a gui app and won't crash at start. It seems that WriteResponseFile lacks the code to add the ENTRY section to the link.res script but I don't know if it's supposed to be there or should it be in another stage, any comments?

You need to use {$apptype gui} or use the -WG parameter. For the compiler it is not known if the application needs a console or not.

Peter

Vincent Snijders
to Peter Vreman
Peter Vreman wrote 11 lines
At 01:12 1-8-2005, you wrote: > Trying to find why lazarus crashes at start in win98 I found a > courious problem, global variable IsConsole is true when it should be > false as lazarus is built as a gui application. > You need to use {$apptype gui} or use the -WG parameter. For the compiler it is not known if the application needs a console or not.

If you use -WG, IsConsole should be false. Correct?

Vincent.

Jesus Reyes
to Peter Vreman: You need to use {$apptype gui} or use the -WG parameter. For the compiler it is not known…
--- Peter Vreman wrote 43 lines
At 01:12 1-8-2005, you wrote: >Trying to find why lazarus crashes at start in win98 I found a courious >problem, global variable IsConsole is true when it should be false as >lazarus is built as a gui application. > >Digging I found that IsConsole is set in two functions in wprt0.as: >_mainCRTStartup sets to true and _WinMainCRTStartup sets to False, this >cause a wrong setup of standard Output that DebugLn (lclprocs.pas) use to >emit debug messages. > >It seems that this functions are 'used' in the linker script, for example >ld .--verbose shows that by default a ENTRY(_mainCRTStartup) it's used. I >looked into the generated lazarus link.res file and didn't find a ENTRY >section so I guess it uses the default and that's why even when lazarus is >a gui app, it's linked as a console app. > >To demostrate this I modified the link.res script to inculde >ENTRY(_WinMainCRTStartup) section and then linked, the resulting >lazarus.exe file now behaves as a gui app and won't crash at start. > >It seems that WriteResponseFile lacks the code to add the ENTRY section to >the link.res script but I don't know if it's supposed to be there or >should it be in another stage, any comments? You need to use {$apptype gui} or use the -WG parameter. For the compiler it is not known if the application needs a console or not. Peter

Lazarus is already compiled with -WG

Jesus Reyes A.

__________________________________________________ Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! Regístrate ya - http://correo.yahoo.com.mx/