Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-08

How to add & change application EnvironmentList ?

25 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

FreeMan

Hello,
In kubuntu x64.
I need add and change Application EnvironmentList items. In unix. I mean, I need add this lines,
export LD_LIBRARY_PATH=/opt/firebird/Embeded/fb_embed_linux64 export FIREBIRD=/opt/firebird/Embeded/fb_embed_linux64 PATH=$PATH:/opt/firebird/Embeded/fb_embed_linux64
how to do this in lazarus? This is work just Application session thank you.

Reply by email

Michael Van Canneyt
to FreeMan
FreeMan wrote 8 lines
Hello, In kubuntu x64. I need add and change Application EnvironmentList items. In unix. I mean, I need add this lines, export LD_LIBRARY_PATH=/opt/firebird/Embeded/fb_embed_linux64 export FIREBIRD=/opt/firebird/Embeded/fb_embed_linux64 PATH=$PATH:/opt/firebird/Embeded/fb_embed_linux64 how to do this in lazarus? This is work just Application session

You can set these in the Run|Run Parameters dialog, tab 'Environment'

Michael.

Reply by email

FreeMan
to Michael Van Canneyt
Thank you Michael,
This is work just under IDE, I mean if application start from IDE, then
this added variables getting from list. I need, when application run
with out IDE, I want add or change values from in application.
I tried this code, but not added to application's variable list
      AProcess.Executable := '/bin/sh';
       AProcess.Parameters.Text := 'export LD_LIBRARY_PATH=' + fb_RootPath;
       AProcess.Parameters.Add('export FIREBIRD LD_LIBRARY_PATH=' +
fb_RootPath);
       AProcess.Parameters.Add('export PATH=$PATH:' + fb_RootPath);
AProcess.Execute;
Michael Van Canneyt wrote 16 lines
On Wed, 26 Aug 2015, FreeMan wrote: > Hello, > In kubuntu x64. > I need add and change Application EnvironmentList items. In unix. I > mean, I need add this lines, > export LD_LIBRARY_PATH=/opt/firebird/Embeded/fb_embed_linux64 > export FIREBIRD=/opt/firebird/Embeded/fb_embed_linux64 > PATH=$PATH:/opt/firebird/Embeded/fb_embed_linux64 > how to do this in lazarus? This is work just Application session You can set these in the Run|Run Parameters dialog, tab 'Environment' Michael.

Reply by email

Michael Van Canneyt
to FreeMan
FreeMan wrote 11 lines
Thank you Michael, This is work just under IDE, I mean if application start from IDE, then this added variables getting from list. I need, when application run with out IDE, I want add or change values from in application. I tried this code, but not added to application's variable list AProcess.Executable := '/bin/sh'; AProcess.Parameters.Text := 'export LD_LIBRARY_PATH=' + fb_RootPath; AProcess.Parameters.Add('export FIREBIRD LD_LIBRARY_PATH=' + fb_RootPath); AProcess.Parameters.Add('export PATH=$PATH:' + fb_RootPath); AProcess.Execute;

AProcess.Environment must be used for this.

Michael.

Reply by email

FreeMan
to Michael Van Canneyt
Michael Van Canneyt wrote
AProcess.Environment must be used for this. Michael.

Sorry, I didn't understand what you mean.
This is my test code, before and after execute, write all environment variables in memo1, but same variables. Tprocess class similar not working.

     if Assigned(AProcess)then FreeAndNil(AProcess);
     AProcess := TProcess.Create(Application);
     AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
       Form1.Memo1.Clear;
       for I := 1 to GetEnvironmentVariableCount do begin
       AProcess.Environment.Add(GetEnvironmentString(I));
       Form1.Memo1.Lines.Add(GetEnvironmentString(I));
       end;
       Form1.Memo1.Lines.Add('');
       Form1.Memo1.Lines.Add('-------------------------------');
       Form1.Memo1.Lines.Add('--------------------');
       Form1.Memo1.Lines.Add('');
       AProcess.Executable := '/bin/sh';
       AProcess.Parameters.Text := 'export LD_LIBRARY_PATH=' + fb_RootPath;
       AProcess.Execute;
         Form1.Memo1.Lines.LoadFromStream(AProcess.Output);  // -->>
outpu is empty
        for I := 1 to GetEnvironmentVariableCount do
         Form1.Memo1.Lines.Add(GetEnvironmentString(I));

Reply by email

Michael Van Canneyt
to FreeMan
FreeMan wrote 14 lines
On 26.08.2015 18:35, Michael Van Canneyt wrote: > AProcess.Environment must be used for this. > > Michael. Sorry, I didn't understand what you mean. This is my test code, before and after execute, write all environment variables in memo1, but same variables. Tprocess class similar not working. if Assigned(AProcess)then FreeAndNil(AProcess); AProcess := TProcess.Create(Application); AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes]; Form1.Memo1.Clear; for I := 1 to GetEnvironmentVariableCount do begin AProcess.Environment.Add(GetEnvironmentString(I));

Here you must add

      AProcess.Environment.Add('LD_LIBRARY_PATH='+fb_RootPath);

It is not necessary to execute the shell.

I use this technique myself, so I am sure it works.

Michael.

Reply by email

FreeMan
to Michael Van Canneyt
Michael Van Canneyt wrote 9 lines
Here you must add AProcess.Environment.Add('LD_LIBRARY_PATH='+fb_RootPath); It is not necessary to execute the shell. I use this technique myself, so I am sure it works. Michael.

Sorry Micheal, you miss understood me. first of all, thank you, I learned one more think.
My problem is, adding EnvironmentVariable to application. In terminal "export" command do this, then run application in this terminal. I need this for, firebird embeded need this two EnvironmentVariable. Applcation can be any folder, so my solution is add this two EnvironmentVariable from in application. I hope I can translate my problem.

Reply by email

Michael Van Canneyt
to FreeMan
FreeMan wrote 13 lines
On 26.08.2015 21:22, Michael Van Canneyt wrote: > Here you must add > > AProcess.Environment.Add('LD_LIBRARY_PATH='+fb_RootPath); > > It is not necessary to execute the shell. > > I use this technique myself, so I am sure it works. > > Michael. Sorry Micheal, you miss understood me. first of all, thank you, I learned one more think. My problem is, adding EnvironmentVariable to application.

I understand this. That is exactly what AProcess.Environment does.

Michael.

Reply by email

FreeMan
to Michael Van Canneyt
Michael Van Canneyt wrote
I understand this. That is exactly what AProcess.Environment does. Michael.
       AProcess.Environment.Add('LD_LIBRARY_PATH=' + fb_RootPath);
       AProcess.Environment.Add('FIREBIRD=' + fb_RootPath);
       for I := 0 to GetEnvironmentVariableCount do begin
         AProcess.Environment.Add(GetEnvironmentString(I));
         Form1.Memo1.Lines.Add(AProcess.Environment.Strings[I]);
       end;
       Form1.Memo1.Lines.Add('');
       Form1.Memo1.Lines.Add('-------------------------------');
       Form1.Memo1.Lines.Add('--------------------');
       Form1.Memo1.Lines.Add('');
  Application.GetEnvironmentList(Form1.Memo1.Lines);

this is result:
1-) AProcess.Environment result
LD_LIBRARY_PATH=/opt/proje_laz/projeler/shared/firebird/Embeded/test/fb_embed_linux64/ FIREBIRD=/opt/proje_laz/projeler/shared/firebird/Embeded/test/fb_embed_linux64/ KDE_FULL_SESSION=true
KDE_FULL_SESSION=true
GNOME_KEYRING_PID=1900
GS_LIB=/home/freeman/.fonts

................................
................................

2-)Application.GetEnvironmentList result
KDE_FULL_SESSION=true
GNOME_KEYRING_PID=1900
GS_LIB=/home/freeman/.fonts

var AProcess: TProcess;
AProcess := TProcess.Create(Application);

AProcess is different class, is that synchronous with main application's EnvironmentList ? My test is say no. It's not work in same session. For test I made bash sript, I wrote in export bla bla then execute it with tprocess, but not added to application's EnvironmentList.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150826/614afc9e/attachment.html>

Reply by email

Michael Van Canneyt
to FreeMan
FreeMan wrote 41 lines
On 26.08.2015 22:22, Michael Van Canneyt wrote: > I understand this. That is exactly what AProcess.Environment does. > > Michael. AProcess.Environment.Add('LD_LIBRARY_PATH=' + fb_RootPath); AProcess.Environment.Add('FIREBIRD=' + fb_RootPath); for I := 0 to GetEnvironmentVariableCount do begin AProcess.Environment.Add(GetEnvironmentString(I)); Form1.Memo1.Lines.Add(AProcess.Environment.Strings[I]); end; Form1.Memo1.Lines.Add(''); Form1.Memo1.Lines.Add('-------------------------------'); Form1.Memo1.Lines.Add('--------------------'); Form1.Memo1.Lines.Add(''); Application.GetEnvironmentList(Form1.Memo1.Lines); this is result: 1-) AProcess.Environment result LD_LIBRARY_PATH=/opt/proje_laz/projeler/shared/firebird/Embeded/test/fb_embed_linux64/ FIREBIRD=/opt/proje_laz/projeler/shared/firebird/Embeded/test/fb_embed_linux64/ KDE_FULL_SESSION=true KDE_FULL_SESSION=true GNOME_KEYRING_PID=1900 GS_LIB=/home/freeman/.fonts ................................ ................................ 2-)Application.GetEnvironmentList result KDE_FULL_SESSION=true GNOME_KEYRING_PID=1900 GS_LIB=/home/freeman/.fonts var AProcess: TProcess; AProcess := TProcess.Create(Application); AProcess is different class, is that synchronous with main application's EnvironmentList ?

For the newly started process, yes.
Not for the CURRENT process.

My test is say no. It's not work in same session. For test I made bash sript, I wrote in export bla bla then execute it with tprocess, but not added to application's EnvironmentList.

In the calling program: Of course not. only in the called program.

I use this technique to provide environment parameters to a newly started program since many years.

Michael.

Reply by email

FreeMan
to Michael Van Canneyt
Michael Van Canneyt wrote 5 lines
I use this technique to provide environment parameters to a newly started program since many years. Michael.

You mean, need make "starproject1" application and its starts to "project1" main application. Is this right? If this answer is yes, I think bash script is much easy way, because Application can check system parameter, or others, then create bash script and terminate self, and maybe (need test) on terminate run created script. If TProcess can get extra parameter, why not add to current process? but I think this is compiler site problem, get variable function is there but there is no get functions.

Reply by email

Michael Van Canneyt
to FreeMan
FreeMan wrote 15 lines
On 27.08.2015 00:44, Michael Van Canneyt wrote: > > I use this technique to provide environment parameters to a newly started > program since many years. > > Michael. You mean, need make "starproject1" application and its starts to "project1" main application. Is this right? If this answer is yes, I think bash script is much easy way, because Application can check system parameter, or others, then create bash script and terminate self, and maybe (need test) on terminate run created script. If TProcess can get extra parameter, why not add to current process? but I think this is compiler site problem, get variable function is there but there is no get functions.

I'm sorry, I absolutely do not understand what you want to say.

Application.EnvironmentList contains the environment of the current process. You must consider this read-only.

TProcess.Environment can be used to specify the environment of a newly started process.

Michael.

Reply by email

Petr Hložek
to FreeMan: You mean, need make "starproject1" application and its starts to "project1" main…
Show quoted text 5 lines
If TProcess can get extra parameter, why not add to current process? but I > think this is compiler site problem, get variable function is there but > there is no get functions.

If you wan to add a variable to current process, please look here: http://sourceforge.net/p/cqrlog/code/HEAD/tree/branches/cqrlog_0.9/cqrlog.lpr and look at
setenv(PChar('FIREBIRD'),PChar(ExtractFilePath(Application.Exename)),1);

But you have to do that first, before all is incialized.

Petr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150827/22c42ff9/attachment.html>

Reply by email

FreeMan
to Michael Van Canneyt: I'm sorry, I absolutely do not understand what you want to say.…
Michael Van Canneyt wrote
I'm sorry, I absolutely do not understand what you want to say.

Sorry for my english. Think Turkish then translate via dictionary.

Application.EnvironmentList contains the environment of the current process. You must consider this read-only.

I need to add "firebird" variable(s) to environment of the current process. So application can use that(s)

TProcess.Environment can be used to specify the environment of a newly started process.

forget TProcess. 'cos its newly started process.
But If I can run "export" command in current process (current mean application's process) it will be add and application can use that.

Michael.

I hope this time I translated what I need. :)

Reply by email

Michael Van Canneyt
to FreeMan
FreeMan wrote 9 lines
On 27.08.2015 12:58, Michael Van Canneyt wrote: > I'm sorry, I absolutely do not understand what you want to say. Sorry for my english. Think Turkish then translate via dictionary. > Application.EnvironmentList contains the environment of the current > process. > You must consider this read-only. I need to add "firebird" variable(s) to environment of the current process. So application can use that(s)
That is not possible;
You must do this before the process is started.

I do this using a shell script that sets the necessary variables, and which then starts the actual binary.

Michael.

Reply by email

Petr Hložek
to FreeMan: Sorry for my english. Think Turkish then translate via dictionary. I need to add…
Show quoted text 7 lines
> I need to add "firebird" variable(s) to environment of the current process. So application can use that(s) > >

Look at what I wrote. I had the same problem years ago and solved it.

Petr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150827/6a0d5e78/attachment.html>

Reply by email

Michael Van Canneyt
to Petr Hložek: If you wan to add a variable to current process, please look here:…
Petr Hlo?ek wrote 11 lines
> If TProcess can get extra parameter, why not add to current process? but I >> think this is compiler site problem, get variable function is there but >> there is no get functions. > > If you wan to add a variable to current process, please look here: http://sourceforge.net/p/cqrlog/code/HEAD/tree/branches/cqrlog_0.9/cqrlog.lpr and look at setenv(PChar('FIREBIRD'),PChar(ExtractFilePath(Application.Exename)),1); But you have to do that first, before all is incialized.

That only works on i386, because you use the libc unit.

Michael.

Reply by email

FreeMan
to Petr Hložek: Look at what I wrote. I had the same problem years ago and solved it. Petr --------------…

Thank you Petr,
I'm looking for and testing as long as saw first mail. Need import that function. If I'm not wrong, thats C library and this mean can work under osx too. I'll write result.

Petr Hlo?ek wrote 10 lines
I need to add "firebird" variable(s) to environment of the current process. So application can use that(s) Look at what I wrote. I had the same problem years ago and solved it. Petr

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150827/c1f2f9ed/attachment.html>

Reply by email

FreeMan
to Michael Van Canneyt: That only works on i386, because you use the libc unit. Michael.
Michael Van Canneyt wrote
That only works on i386, because you use the libc unit. Michael.

unfortunately, you right. Its not worked. :( result is 0 but its not worked. If its in i386, whats equal in x64?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150827/ea2d8e3e/attachment-0001.html>

Reply by email

Petr Hložek
to FreeMan

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

2015-08-27 14:57 GMT+02:00 FreeMan :

Show quoted text 16 lines
On 27.08.2015 14:34, Michael Van Canneyt wrote: That only works on i386, because you use the libc unit. Michael. unfortunately, you right. Its not worked. :( result is 0 but its not worked. If its in i386, whats equal in x64? -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150827/b1e06561/attachment.html>

Reply by email

FreeMan
to Petr Hložek
Petr Hlo?ek wrote 11 lines
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.

Reply by email

Petr Hložek
to FreeMan

I used Firebird a few years ago, I'm not sure what could be wrong. How do you inicialize Firebird? I had to load libraries manually with something like this:

  LoadLibrary(ExtractFilePath(Application.ExeName) +
'lib/libstdc++.so.5.0.7');
  LoadLibrary(ExtractFilePath(Application.ExeName) +
'lib/libicudata.so.30.0');
  LoadLibrary(ExtractFilePath(Application.ExeName) +
'lib/libicuuc.so.30.0');
  LoadLibrary(ExtractFilePath(Application.ExeName) +
'lib/libicui18n.so.30.0');
  DataBase.DatabaseName := fDataDir + 'cqrlog.fdb';
  DataBase.UserName := 'SYSDBA';
  DataBase.PassWord := 'masterkey';
  DataBase.LibraryName  := ExtractFilePath(Application.ExeName) +
'lib/libfbembed.so.2.1.1';

but I used UIB components. Also had to do some changes to firebird.conf. I'm sorry, don't remeber details :(.

2015-08-27 16:19 GMT+02:00 FreeMan :

Show quoted text 64 lines
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. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150827/09330556/attachment.html>

Reply by email

FreeMan
to Petr Hložek

No need to "LoadLibrary" But I'll try your way too :) My way and firebird do this when install firebird. Add "export" command to default bash script, (I forget it name now.) I'm using zsh for this, in user home folder "~/.zshrc"
this example for osx
export FIREBIRD_HOME=/Library/Frameworks/Firebird.framework/Resources export PATH=$PATH:$FIREBIRD_HOME/bin

after this just need library name. For embeded, need two variables export LD_LIBRARY_PATH=/where to libfbembed library's folder export FIREBIRD=/where to libfbembed library's folder

after then just need "libfbembed.so"
So, I'm looking for, how to run export command in current process, then can I use fbembed. I'll try your way maybe not need to export path.

Petr Hlo?ek wrote 21 lines
I used Firebird a few years ago, I'm not sure what could be wrong. How do you inicialize Firebird? I had to load libraries manually with something like this: LoadLibrary(ExtractFilePath(Application.ExeName) + 'lib/libstdc++.so.5.0.7'); LoadLibrary(ExtractFilePath(Application.ExeName) + 'lib/libicudata.so.30.0'); LoadLibrary(ExtractFilePath(Application.ExeName) + 'lib/libicuuc.so.30.0'); LoadLibrary(ExtractFilePath(Application.ExeName) + 'lib/libicui18n.so.30.0'); DataBase.DatabaseName := fDataDir + 'cqrlog.fdb'; DataBase.UserName := 'SYSDBA'; DataBase.PassWord := 'masterkey'; DataBase.LibraryName := ExtractFilePath(Application.ExeName) + 'lib/libfbembed.so.2.1.1'; but I used UIB components. Also had to do some changes to firebird.conf. I'm sorry, don't remeber details :(.

Reply by email

FreeMan
to Petr Hložek: I used Firebird a few years ago, I'm not sure what could be wrong. How do you inicialize…
Yes, now I can access to fbemdeb. kubuntu 14.10 x64
How to do:
this code from Petr (Thank you) in lpr file
{$IFDEF UNIX}
   function setenv(_para1:Pchar; _para2:Pchar;
_para3:longint):longint;cdecl;external 'libc' name 'setenv';
{$ENDIF UNIX}
{$R *.res}
begin
//fb_RootPath usually unde the application folder
   setenv(PChar('FIREBIRD'), PChar(fb_RootPath), 1);
and this code part for load libraries
   {$IFDEF LINUX} // Firebird 2.5.4 x64
   //LoadLibrary(fb_RootPath + 'lib/libstdc++.so.5.0.7');  No need this
for me
   LoadLibrary(fb_RootPath + 'libicudata.so.30.0');
   LoadLibrary(fb_RootPath + 'libicuuc.so.30.0');
   LoadLibrary(fb_RootPath + 'libicui18n.so.30.0');
   {$ENDIF}

Need to don't forget to unload libraries. If I'm not wrong this way will work on osx as well. I'll write thats result too.

Thank you Petr and Michael.

Petr Hlo?ek wrote 21 lines
used Firebird a few years ago, I'm not sure what could be wrong. How do you inicialize Firebird? I had to load libraries manually with something like this: LoadLibrary(ExtractFilePath(Application.ExeName) + 'lib/libstdc++.so.5.0.7'); LoadLibrary(ExtractFilePath(Application.ExeName) + 'lib/libicudata.so.30.0'); LoadLibrary(ExtractFilePath(Application.ExeName) + 'lib/libicuuc.so.30.0'); LoadLibrary(ExtractFilePath(Application.ExeName) + 'lib/libicui18n.so.30.0'); DataBase.DatabaseName := fDataDir + 'cqrlog.fdb'; DataBase.UserName := 'SYSDBA'; DataBase.PassWord := 'masterkey'; DataBase.LibraryName := ExtractFilePath(Application.ExeName) + 'lib/libfbembed.so.2.1.1'; but I used UIB components. Also had to do some changes to firebird.conf. I'm sorry, don't remeber details :(.

Reply by email

FreeMan
to FreeMan
Hello,
fpc r31436 lazarus r49722 osx yosemite 10.10.5 qtx64 Firebird 2.5.4 embeded.
This code worked on my sytem too. No need to use any loadlibrary. Just
unix need it.
{$IFDEF UNIX}
   function setenv(_para1:Pchar; _para2:Pchar;
_para3:longint):longint;cdecl;external 'libc' name 'setenv';
{$ENDIF UNIX}

Thank you again Petr and Michael.

FreeMan wrote 49 lines
Yes, now I can access to fbemdeb. kubuntu 14.10 x64 How to do: this code from Petr (Thank you) in lpr file {$IFDEF UNIX} function setenv(_para1:Pchar; _para2:Pchar; _para3:longint):longint;cdecl;external 'libc' name 'setenv'; {$ENDIF UNIX} {$R *.res} begin //fb_RootPath usually unde the application folder setenv(PChar('FIREBIRD'), PChar(fb_RootPath), 1); and this code part for load libraries {$IFDEF LINUX} // Firebird 2.5.4 x64 //LoadLibrary(fb_RootPath + 'lib/libstdc++.so.5.0.7'); No need this for me LoadLibrary(fb_RootPath + 'libicudata.so.30.0'); LoadLibrary(fb_RootPath + 'libicuuc.so.30.0'); LoadLibrary(fb_RootPath + 'libicui18n.so.30.0'); {$ENDIF} Need to don't forget to unload libraries. If I'm not wrong this way will work on osx as well. I'll write thats result too. Thank you Petr and Michael. On 27.08.2015 17:47, Petr Hlo?ek wrote: > used Firebird a few years ago, I'm not sure what could be wrong. How > do you inicialize Firebird? I had to load libraries manually with > something like this: > > LoadLibrary(ExtractFilePath(Application.ExeName) + > 'lib/libstdc++.so.5.0.7'); > LoadLibrary(ExtractFilePath(Application.ExeName) + > 'lib/libicudata.so.30.0'); > LoadLibrary(ExtractFilePath(Application.ExeName) + > 'lib/libicuuc.so.30.0'); > LoadLibrary(ExtractFilePath(Application.ExeName) + > 'lib/libicui18n.so.30.0'); > DataBase.DatabaseName := fDataDir + 'cqrlog.fdb'; > DataBase.UserName := 'SYSDBA'; > DataBase.PassWord := 'masterkey'; > DataBase.LibraryName := ExtractFilePath(Application.ExeName) + > 'lib/libfbembed.so.2.1.1'; > > but I used UIB components. Also had to do some changes to > firebird.conf. I'm sorry, don't remeber details :(.

Reply by email