[Lazarus] How to add & change application EnvironmentList ?

FreeMan freeman35 at delphiturkiye.com
Thu Aug 27 16:19:02 CEST 2015


On 27.08.2015 16:25, Petr Hložek wrote:
> My app has also 64bit support and works. I use setenv also in 64bit 
> system but only in linux. Maybe that is the problem. The link I sent 
> before, was from old source code.
>
> I use this unit to disable Ubuntu scrollbars 
> using LIBOVERLAY_SCROLLBAR variable. It doesn't use libc unit in uses 
> but loads it directly from so file.
>
> https://github.com/ok2cqr/cqrlog/blob/master/src/uScrollBars.pas
>
> Petr
Thank you Petr,
First link in sourceforge.net, This files and "src" folder not there. I 
founded similar code in some gtk..... file and I tried from that. But 
this last example from your link, and file. setenv function result 
return 0 If I'm not wrong this mean is success. Someting is wrong but 
what is wrong ? :)

program fb_embed_test;

{$mode objfpc}{$H+}

uses
   {$IFDEF UNIX}{$IFDEF UseCThreads}
   cthreads,
   {$ENDIF}{$ENDIF}
   Interfaces, // this includes the LCL widgetset
   sysutils,
   Forms, Unit1
   { you can add units after this };

{$IFDEF UNIX}
   function setenv(_para1:Pchar; _para2:Pchar; 
_para3:longint):longint;cdecl;external 'libc' name 'setenv';
{$ENDIF UNIX}

{$R *.res}
var L : LongInt;
begin
   L := setenv(PChar('FIREBIRD'), 
PChar(ExtractFilePath(Application.Exename)), 1);
   L := setenv(PChar('LD_LIBRARY_PATH'), 
PChar(ExtractFilePath(Application.Exename)), 1);
   RequireDerivedFormResource := True;
   Application.Initialize;
   Application.CreateForm(TForm1, Form1);
   Application.Run;
end.


and this is for test in unit1
  Memo1.Lines.Clear;
   Application.GetEnvironmentList(Memo1.Lines);
I can not see that added variables. And can not access fbembeded.




More information about the Lazarus mailing list