HOWTO: Using libfreevec using LD_PRELOAD

Ok, let's suppose you've downloaded libfreevec, built it successfully and now you want to use it for the whole system, without recompiling the whole system to use the library! Is it possible? Thanks to a glibc feature you can!

There are two ways to do that:

  • one is to use the LD_PRELOAD environment variable, eg. at boot time, but there is a more elegant way to do this.
  • by use of the /etc/ file, which is most likely distro-agnostic, so that the dynamic loader loads libfreevec before any other library (including

    The 2nd is a much more elegant solution, IMHO, and I've been using it for months with no problems whatsoever. So, after you install the library somewhere (by default it's installed in /usr/local/lib/) you could just do a:

    echo /usr/local/lib/ > /etc/

    Beware it has to be the and not the as the 2nd one prefixes each function with vec_ and is only useful to someone that wants to use the library explicitly -for whatever reason.

    The next application you will load you will use the AltiVec functions in libfreevec! Enjoy! :)

    Note: This has a slight overhead which would reduce some of the performance in the functions, but would still prove a good move in most cases.