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?
There are often ways to link shared libraries "statically" -- to
bring the entire shared library in to an executable as if it had
originally been a non-shared library. If you did that, then any
dynamic library search path would not matter, as the library would
not be listed as needing to be dynamically found.
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). Perhaps you want a general unix programming group,
or perhaps you want a programming group specific to whatever OS you
are using. I could give you the answer for the system I'm using
right now, but I have no idea whether the solution would work for
whatever OS you are using (probably not, though.)