I'm working on a simple wrapper which embeds the Ruby runtime and a\nscript file into a single binary. The idea is to have something much\nlike Exerb, but platform-independent (i.e., works anywhere Ruby does).\nIt reads the size and offset of an included script from the last few\nbytes of the program binary, closes stdin and reopens it as a handle\nto argv, and seeks to the script offset before initializing Ruby.\n\nEverything goes fine until I call ruby_options(argv, argc), at which\npoint I get an Errno::EINVAL exception. Does anyone with a little more\nexperience working with the Ruby core have any suggestions for why\nthis could be happening? I know that the filehandle is valid, since I\ndo a number of I/O ops on it from C before passing control to Ruby.\n\nI know that I could just copy out the script data to another file, or\neval it as a string, but there are potential problems with that:\nspecifically, the fact that I'm trying to distribute binary files\nalong with my Ruby program, which will be added to the __END__ section\nof the Ruby script before it is appended to the wrapper binary. Since\nthese files will be quite large (50-150MB), I want to avoid copying\nthem to another file, or loading them fully into RAM, if at all\npossible.\n\nAny ideas would be greatly appreciated. I can post code snippets first\nthing tomorrow morning once I'm back at work; I just wanted to see if\nanyone had any quick suggestions before that.