[Lazarus] Web Module not works on Linux

Sven Barth pascaldragon at googlemail.com
Sat Nov 20 13:39:07 CET 2010


On 20.11.2010 13:30, Sven Barth wrote:
> On 20.11.2010 13:18, silvioprog wrote:
>> Hi Michael, ;)
>>
>> 2010/11/19 <michael.vancanneyt at wisa.be
>> <mailto:michael.vancanneyt at wisa.be>>
>>
>>
>> Well, you can not use it in a CGI application. Interfaces is for GUI
>> support. A CGI by definition has no GUI.
>>
>>
>> But in Windows works perfectly, the error is only in Linux (Ubuntu). :(
>>
>
> That's just a coincidence. Don't use unit interfaces in non GUI
> applications.
>
>> It makes no sense to use it. Why would you need that ?
>>
>>
>> Hm..., I need of Interfaces to use my new function (LSStreamToBase64Str
>> [http://code.google.com/p/lazsolutions/source/browse/trunk/Core/LSUtils.pas#546]).
>>
>> For a better explanation, see the simple project in attached (rename
>> from "LSStreamToBase64Str_CGITeste.zip_" to
>> "LSStreamToBase64Str_CGITeste.zip"). If possible, test the TestWithLRS
>> demo.
>
> 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.

I've looked at your unit again:

The only functions that rely on GUI seem to be LSOpenDialog and 
LSGetWorkAreaRect. You should move those to a LSGUIUtils unit (or 
however you want to name it) and remove the units Classes, Dialogs, 
ExtDlgs and Forms from the uses clause of LSUtils.

Another note on one of your functions:
You are aware that LSCurrentUserName will return the user who COMPILED 
the unit, not the one that is running the application?
If you want to get the environment variable at runtime you should use 
GetEnvironmentVariable (for documentation see here: 
http://www.freepascal.org/docs-html/rtl/sysutils/getenvironmentvariable.html 
). You also don't need to use the "%...%" when using that function.

Regards,
Sven




More information about the Lazarus mailing list