Skip to content

Instantly share code, notes, and snippets.

@banister
Created October 15, 2011 14:11
Show Gist options
  • Save banister/1289619 to your computer and use it in GitHub Desktop.
Save banister/1289619 to your computer and use it in GitHub Desktop.
using LD_PRELOAD to override functions like rb_raise() in ruby with my own definitions in an .so
If you set LD_PRELOAD to the path of a shared object, that file will be loaded before any other library (including the C runtime, libc.so). So to run ls with a your special malloc() implementation, do this:
$ LD_PRELOAD=/path/to/my/malloc.so /bin/ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment