2

I've successfully used a hook under Linux with this article: http://hackerboss.com/overriding-system-functions-for-fun-and-profit/

Now I want to make my .so file load every time espeak loads up, no matter if it's called from another application. How do I do that?

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
blez
  • 183
  • 5

1 Answers1

8

You could move the espeak binary to something like espeak-real, and replace it with a small script that sets LD_PRELOAD before exec'ing espeak-real.

#! /bin/bash
export LD_PRELOAD=/your/lib.so
exec espeak-real "$@"

(stdin/out/err redirections take care of themselves.)

Mat
  • 51,578
  • 10
  • 158
  • 140