-1

Just as the title said, I don't know where does this variable locate. I just know how to change it by typing: $ export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libXpm.so.4 Then is it possible to change it in its file?

JasonLi
  • 249
  • 3
  • 9

1 Answers1

0

LD_PRELOAD is an environment variable (part of the "environment" defined by the C library and Unix conventions). That specific variable tells the dynamic linker how to behave.

It is probably not set to anything by default. If you want to give it a default value every time you log in or start up a shell, you can put that export statement in your .profile or .bashrc file (or whatever the equivalent is for your shell of choice). There's probably also a place you could set it in /etc that would apply to all logins or shells started on your system (if you need it to be set for other users too).

If you only need to set it for a specific program though, that may be overkill. Instead, you might want to write a short shell script to set the environment variable up first, then launch the program. E.G.:

#!/bin/bash

export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libXpm.so.4
~/my_program_that_needs_a_special_library
Blckknght
  • 100,903
  • 11
  • 120
  • 169