Sign in Join

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

Mailing lists / fpc-pascal / 2015-06

Multipe path in TProcess.Environment ?

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

fredvs

Hello.

If a TProcess runs a executable who needs a library, that does the trick =>
TProcess.Environment.Text := 'LD_PRELOAD='/the/directory/of/thelibrary.so'
;

You may also use this => (it seems bad ;-( =>
http://xahlee.info/UnixResource_dir/_/ldpath.html ) => TProcess.Environment.Text := 'LD_LIBRARY_PATH=/the/path/of/library'

But what if multiple libraries are needed ?
I have try with =>
TProcess.Environment.Text :=
'LD_PRELOAD=/the/directory/of/thelibrary1.so;/the/directory/of/thelibrary2.so' ;
But without luck.

Same for LD_LIBRARY_PATH, how to define multiple path ? => TProcess.Environment.Text :=
'LD_LIBRARY_PATH=/the/directory1/;/the/directory2/' Without luck too. ;-(

Many thanks.

Fre;D

-----
Many thanks ;-)

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Multipe-path-in-TProcess-Environment-tp5721893.html Sent from the Free Pascal - General mailing list .
Tomas Hajny
to fredvs
fredvs wrote 17 lines
Hello. If a TProcess runs a executable who needs a library, that does the trick => TProcess.Environment.Text := 'LD_PRELOAD='/the/directory/of/thelibrary.so' ; You may also use this => (it seems bad ;-( => http://xahlee.info/UnixResource_dir/_/ldpath.html ) => TProcess.Environment.Text := 'LD_LIBRARY_PATH=/the/path/of/library' But what if multiple libraries are needed ? I have try with => TProcess.Environment.Text := 'LD_PRELOAD=/the/directory/of/thelibrary1.so;/the/directory/of/thelibrary2.so' ; But without luck.

.
.

Unix uses a colon as path delimiter, not semicolon. I don't know about LD_PRELOAD, but it should work at least for LD_LIBRARY_PATH.

Tomas

fredvs
to Tomas Hajny

@ Thomas => tanks for answer.

Unix uses a colon as path delimiter, not semicolon. I don't know about LD_PRELOAD, but it should work at least for LD_LIBRARY_PATH.

Ha, ok... (by the way, what character is "colon" ?)

So LD_PRELOAD and LD_LIBRARY_PATH are unix only ?
What about Windows, what should be the TProcess.Environment.Text ?

Many thanks.

Fre;D

-----
Many thanks ;-)

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Multipe-path-in-TProcess-Environment-tp5721893p5721898.html Sent from the Free Pascal - General mailing list .
fredvs
to fredvs
Ha, ok... (by the way, what character is "colon" ?)

=> https://en.wikipedia.org/wiki/Colon_%28punctuation%29

=> OK.

But =>

So LD_PRELOAD and LD_LIBRARY_PATH are unix only ? What about Windows, what should be the TProcess.Environment.Text ?

=> not OK.

Thanks.

Fre;D

-----
Many thanks ;-)

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Multipe-path-in-TProcess-Environment-tp5721893p5721899.html Sent from the Free Pascal - General mailing list .
Tomas Hajny
to fredvs

On Mon, June 22, 2015 00:24, fredvs wrote:
.
.

> So LD_PRELOAD and LD_LIBRARY_PATH are unix only ? > What about Windows, what should be the TProcess.Environment.Text ? => not OK.

I'm not aware of an equivalentof LD_PRELOAD on Windows.

As far as LD_LIBRARY_PATH is concerned - as far as I know, MS Windows search for dynamic libraries on PATH (i.e. the same environment variable is used for both binaries and their libraries). You might want to be careful, retrieve the original value using GetEnvironmentVariable and extend it with potential additional paths as necessary rather than just replacing the original value completely.

Tomas

Michael Van Canneyt
to Tomas Hajny
Tomas Hajny wrote 16 lines
On Mon, June 22, 2015 00:24, fredvs wrote: . . >> So LD_PRELOAD and LD_LIBRARY_PATH are unix only ? >> What about Windows, what should be the TProcess.Environment.Text ? > > => not OK. I'm not aware of an equivalentof LD_PRELOAD on Windows. As far as LD_LIBRARY_PATH is concerned - as far as I know, MS Windows search for dynamic libraries on PATH (i.e. the same environment variable is used for both binaries and their libraries). You might want to be careful, retrieve the original value using GetEnvironmentVariable and extend it with potential additional paths as necessary rather than just replacing the original value completely.

The same is true for the environment as a whole.
Most unix environments expect at least PATH, TMP and some others to be set.

So I would rather use .add() instead of setting .text

Michael.