[fpc-pascal] lazarus crash at start

Jesus Reyes jesusrmx at yahoo.com.mx
Mon Aug 1 01:12:07 CEST 2005


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/ 




More information about the fpc-pascal mailing list