lazarus crash at start

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

lazarus crash at start

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 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?

Jesus Reyes A.

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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: lazarus crash at start

Peter Vreman
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


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: lazarus crash at start

Vincent Snijders
Peter Vreman wrote:

> 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.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: lazarus crash at start

Jesus Reyes
In reply to this post by Peter Vreman

 --- Peter Vreman <[hidden email]> escribi?:

> 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/ 

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal