Recent

Author Topic: What is -gl parameter?  (Read 1106 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1593
What is -gl parameter?
« on: June 26, 2024, 08:38:15 am »
Sometimes I see this message when I try to compile Lazarus project.

Right now, I'm trying to make a pas2js project.


Code: Pascal  [Select][+][-]
  1. program project2;
  2.  
  3. {$mode objfpc}
  4.  
  5. uses
  6.    JS, Classes, SysUtils, Web, p2_unit1;
  7. begin
  8.    with TForm1.Create(nil) do
  9.       Button1Click(nil);
  10. end.          
  11.  
  12. // unit having a form
  13. unit p2_unit1;
  14.  
  15. {$mode ObjFPC}
  16.  
  17. interface
  18.  
  19. uses
  20.    Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
  21.  
  22. type
  23.  
  24.    { TForm1 }
  25.  
  26.    TForm1 = class(TForm)
  27.       Button1: TButton;
  28.       procedure Button1Click(Sender: TObject);
  29.    private
  30.  
  31.    public
  32.  
  33.    end;
  34.  
  35. var
  36.    Form1: TForm1;
  37.  
  38. implementation
  39.  
  40. {$R *.lfm}
  41.  
  42. { TForm1 }
  43.  
  44. procedure TForm1.Button1Click(Sender: TObject);
  45. begin
  46.    ShowMessage('Hello, world');
  47. end;
  48.  
  49. end.
  50.  

I could make following run --- the browser's console displayed 'hello, world'.

Code: Pascal  [Select][+][-]
  1. program project2;
  2.  
  3. {$mode objfpc}
  4.  
  5. uses
  6.    JS, Classes, SysUtils, Web, p2_unit1;
  7.  
  8. begin
  9.    Writeln ('hello, world');
  10. end.
  11.  

TRon

  • Hero Member
  • *****
  • Posts: 4310
Re: What is -gl parameter?
« Reply #1 on: June 26, 2024, 09:00:28 am »
Quote
What is -gl parameter?
See documentation:
Quote
-gl        Use line info unit (show more info with backtraces) 
In practice that should provide you a backtrace with source-code line numbers in an attempt to make it easier to detect where the error is situated in your source-code.

edit: In Lazarus that option can be set in the project options, debugging see picture in wiki (Display Line numbers in run-time error backtraces (-gl) )
« Last Edit: June 26, 2024, 09:13:58 am by TRon »
Today is tomorrow's yesterday.

egsuh

  • Hero Member
  • *****
  • Posts: 1593
Re: What is -gl parameter?
« Reply #2 on: June 26, 2024, 09:19:07 am »
I was searching for "compiler options", not command-line options.
Anyway displaying line number seems irrelevant for my case. I need to study Pas2JS a little more.

TRon

  • Hero Member
  • *****
  • Posts: 4310
Re: What is -gl parameter?
« Reply #3 on: June 26, 2024, 09:32:25 am »
I was searching for "compiler options", not command-line options.
You seem to depict them as two different entities but they are actually the same  ;)
Today is tomorrow's yesterday.

Thaddy

  • Hero Member
  • *****
  • Posts: 16807
  • Ceterum censeo Trump esse delendam
Re: What is -gl parameter?
« Reply #4 on: June 26, 2024, 11:40:39 am »
You simply can not use most Lazarus components for a pas2js application.
Changing servers. thaddy.com may be temporary unreachable but restored when the domain name transfer is done.

egsuh

  • Hero Member
  • *****
  • Posts: 1593
Re: What is -gl parameter?
« Reply #5 on: June 27, 2024, 06:33:25 am »
It's strange that it does not work even I have removed forms from the project. It used to work.

 

TinyPortal © 2005-2018