#!/bin/sh
build()
{
    # NOTE: -ldl is a GNU/Linux thing and may not exist on other UNIX systems
    gcc -fPIC -shared preload.c -o preload.so -ldl
}

test -e preload.so || build
test preload.c -nt preload.so && build 
export LD_PRELOAD=$(pwd)/preload.so
exec "$@"
