The rundll32 utility which comes bundled with Windows allows you to run a function in an arbitrary program. Arbitrary, eh? Sounds like fun. There is no equivalent for UNIX until now.
Enter runso, a program that allows you to run an arbitrary function. It's actually more flexible than rundll. Observe the fun of invoking runso libm.so g:cos g:3.14159 or runso libc.so.6 d:strlen s:hello. I suppose a practical use for this is to get access to something like realpath (rather than the absolute wrapper) or maybe ioctl or some other bad idea. In general, this whole thing is a bad idea.
Also, it is entirely non-portable. It runs on i386 machines and should run on any system which has POSIX-compatible dl* calls, but I really wouldn't bank on it. This is another one of those things I created purely for the horror.
It could be improved by doing things with errno, allow dereferencing of symbols, adding support for arrays, and providing something like a char[] to be used as a buffer. Or, it could be sent to the depths of hell.
| Thu, 7 May 2009 16:25:53 -0400 |
|