473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Linking with a particular shared library by full path overridingLD_LIBRARY_PATH

I need my program to always link to a particular shared library, not
the one in LD_LIBRARY_PATH.

Is there a way to specify shared library by full path when linking so
that when running LD_LIBRARY_PATH is ignored?
Apr 10 '08 #1
5 3756
Visa Inquirer wrote:
I need my program to always link to a particular shared library, not
the one in LD_LIBRARY_PATH.
LD_LIBRARY_PATH is both evil and off topic. Try comp.unix.programmer.

--
Ian Collins.
Apr 10 '08 #2
>Beyond that... well, it would probably be better for you to ask in
>a forum that has an idea of what LD_LIBRARY_PATH is. LD_LIBRARY_PATH
is not part of standard C, and is very unlikely to become part of
standard C (the name conflicts with the namespace reserved for
user programs).
The name conflicts in *WHAT* namespace? I don't see any place
in the C standard where environment variable names are reserved for
user programs.

Apr 10 '08 #3
On 10 Apr 2008 at 21:11, Visa Inquirer wrote:
I need my program to always link to a particular shared library, not
the one in LD_LIBRARY_PATH.

Is there a way to specify shared library by full path when linking so
that when running LD_LIBRARY_PATH is ignored?
You can set the program's rpath: this will hard code a dynamic library
search path into your binary, and on most systems this will override
LD_LIBRARY_PATH.

With gcc, you can provide
-rpath dir
as an option when linking, and this will add dir to the executable's
run-time link path.

You should be aware that setting the rpath can cause all sorts of
problems if your program is installed by people who want to install
their libraries somewhere other than your preferred hard-coded search
path.

Apr 10 '08 #4
In article <ssSdnQreJuztEGPanZ2dnUVZ_ofinZ2d@internetamerica> ,
Gordon Burditt <go***********@burditt.orgwrote:
>>Beyond that... well, it would probably be better for you to ask in
a forum that has an idea of what LD_LIBRARY_PATH is. LD_LIBRARY_PATH
is not part of standard C, and is very unlikely to become part of
standard C (the name conflicts with the namespace reserved for
user programs).
>The name conflicts in *WHAT* namespace? I don't see any place
in the C standard where environment variable names are reserved for
user programs.
The original poster made no indication that LD_LIBRARY_PATH was
an environment variable, only that it was a name whose value
the poster wished to be ignored.

--
"Not the fruit of experience, but experience itself, is the end."
-- Walter Pater
Apr 10 '08 #5
In article <sl*******************@nospam.invalid>,
Antoninus Twink <no****@nospam.invalidwrote:
>On 10 Apr 2008 at 21:11, Visa Inquirer wrote:
>I need my program to always link to a particular shared library, not
the one in LD_LIBRARY_PATH.

Is there a way to specify shared library by full path when linking so
that when running LD_LIBRARY_PATH is ignored?
>You can set the program's rpath: this will hard code a dynamic library
search path into your binary, and on most systems this will override
LD_LIBRARY_PATH.
Most systems? I dunno about that. Certainly not on the system I'm
using now -- here the -rpath ld option *adds* the given directory
to the search path, but does not override LD_LIBRARY_PATH (or the
system variations therein such as LD_LIBRARY64_PATH). On the system
I'm using, you have to link with -no_library_replace to prevent
the path specified in the binary from being overridden.
--
"There's no term to the work of a scientist." -- Walter Reisch
Apr 10 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dibyendu Roy | last post by:
Hi All, I build an object called "dblorcle" to connect to oracle database in Sun solaris box. This is built linking with various oracle ".a" (archived, for static linking) files come with standard...
2
by: Ian | last post by:
I've downloaded 3rd party libraries and I'm trying to link them in with my code but when I use -l<library name> it gives me the error "ld: cannot find -l<lib name>". When I link the libraries...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
5
by: chrisse_2 | last post by:
Hi, All the records in my database will contain at least one picture. At the moment all the images are part of the database as ole objects although the database is way to big and there is only...
1
by: Peetah_junkmail | last post by:
Hi, I'm not sure this is completely a C related question since it's more about linking problems, so don't hesitate to redirect me to a more appropriate NG. I have a set of useful functions...
6
by: Rudy Ray Moore | last post by:
I work with a multi-project workspace. One project (the "startup" project) has a "Configuration Type" of "Application (.exe)". The other 40 projects have a "Configuration Type" of "Static Library...
5
by: Joerg M. Colberg | last post by:
My apologies if this is a trivial problem. I have been trying to solve this for a few days now and I just can't get it done. Here's what I have. I have a C++ project in VisualStudio.NET whose code...
10
by: Julian | last post by:
I get the following error when i try to link a fortran library to a c++ code in .NET 2005. LINK : fatal error LNK1104: cannot open file 'libc.lib' the code was working fine when built using...
1
by: sirchia.r | last post by:
Hi all, I'm not very much of a C expert, so I hope one of you is willing to help me out. What I'm trying to do is create a shared object library SO1, to which an executable E is already...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.