[fpc-pascal] lazarus crash at start
Peter Vreman
peter at freepascal.org
Mon Aug 1 09:58:42 CEST 2005
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
More information about the fpc-pascal
mailing list