Next: , Previous: , Up: Top   [Contents]


3 Making the library work

LibHideIP has no magic in it, it won’t intercept calls to the mentioned functions just because it is compiled. Even installing the library in a system directory isn’t enough. The library needs to be loaded into memory. More strictly, it needs to be PRELOADED (loaded before other libraries). This is achieved easily, if you are using ld.so (or derivatives) to load libraries (like on GNU/Linux). Just add the following line:

export LD_PRELOAD=/usr/local/lib/libhideip.so

to your startup scripts (like $HOME/.bashrc, $HOME/.bash_profile). You should change the path to the correct one. If you aren’t using bash, consult your shell manual for details on how to export an environment variable.

This will make the dynamic linker, ld.so, load LibHideIP before loading any other libraries, when starting programs. That is, after the line above gets executed, all programs from that moment start using LibHideIP.

You can alternatively put the full path to the library in the /etc/ld.so.preload (not recommended, because some good programs may need the local IP address). No syntax is required, just the path and filename, like this:

/usr/local/lib/libhideip.so

To load LibHideIP for just one program, type like this (for bash):

LD_PRELOAD=/usr/local/lib/libhideip.so some-program-name