[Lazarus] Web Module not works on Linux

Michael Van Canneyt michael at freepascal.org
Sat Nov 20 14:19:43 CET 2010

On Sat, 20 Nov 2010, silvioprog wrote:

> 2010/11/20 Sven Barth <pascaldragon at googlemail.com>
> That's just a coincidence. Don't use unit interfaces in non GUI applications.
> Hm..., the default code of a new Web Module is (File | New... | Web Module):
> -------
> program Project1;
> {$mode objfpc}{$H+}
> uses
>   {$IFDEF UNIX}{$IFDEF UseCThreads}
>   cthreads,
>   {$ENDIF}{$ENDIF}
>   Interfaces, // this includes the LCL widgetset
>   Forms, Unit1;
> {$R *.res}
> begin
>   Application.Initialize;
>   Application.CreateForm(TFPWebModule1, FPWebModule1);
>   Application.Run;
> end. 
> -------
>       I've looked at that method. It does not rely on any visual code, so I'd suggest you to move those methods that don't use any GUI related code (e.g. dialogs, etc)
>       to another unit where only units from RTL and FCL are included. This unit can then be used within your CGI application without problems.
> Then is not possible use the Graphics unit in CGI module? D:

No, you cannot.

A CGI program has no GUI, and the Graphics unit is only useful for GUI.

I suspect the main program file is generated by the lazcgi package.
If you are using the lazcgi package, remove it. It is outdated and 
generates incorrect code. (although I have local fixes lying around 
that fix precisely your problem)

Use the lazweb package instead. It creates the correct program file
and contains much more functionality than lazcgi.


More information about the Lazarus mailing list