Some APIs only support output to files. e.g. a library that converts a BMP to PNG and only has a Save(file) option – no in memory function. Disk IO is slow, though, and sometimes you just want in-memory operations.
Is there a generic solution to such a problem? Maybe a fake in-memory file of sorts that would allow one to use the library, yet not pay the performance penalty of disk IO?
Use named pipes.
Similar constructs exist for both Windowsand Unix (and this).
But I don’t believe it worth the effort setting up all those constructs. Choose an alternative library or just write to disk if you may.