Solaris runtime dependencies

Solaris ain’t Linux, as a lot of developers seem to forget, and adding gcc doesn’t make it so either. One thing I run into often enough to be annoying, but not often enough to actually remember the incantations, is runtime library dependencies. Linuxmafia has one of the better writeups going, but for my own reference, you can work around this by setting LD_LIBRARY_PATH, which is usually sick, wrong, and evil. Instead, when building, make use of the -L and -R flags:
gcc foo.c -o foo -L/software/bar/lib -R/software/bar/lib
Yeah, pretty easy to forget “R for Runtime”, shut up. Maybe the act of writing this down will fix it in my memory, finally. I also know that same page talks about crle, but I can’t do this for various reasons.