[SDL] [OT] Sound and Music - memory mapped files boost.org

Andre Krause post at andre-krause.net
Mon Sep 19 13:23:08 PDT 2005

Tyler Montbriand wrote:

>On September 18, 2005 09:56 pm, Simon Roby wrote:
>>I fully agree, a portable mmap abstraction would be an incredible
>>addition to SDL. There should be a decent fallback on platforms that
>>don't support it though...
>>- SR
>Now there's a toughie.  How does one emulate memory mapping without 
>actually /doing/ memory mapping?  The only sane thing I can think of is using 
>size-limited, allocated buffers; but that's no good for writing, and for any 
>decently sized file, forces people to do all the seek-abstraction they'd be 
>doing without mmap in the first place.
>Worst case, emulated mmap would be slower and waste more memory than plain 
>file operations.  It might end up just being something that's either 
>supported or not, like CDROMs and timers.  If it ever becomes internal to 
>SDL, maybye it can be used for optimizations there when present...
>Interestingly, while Palm doesn't support mmap /yet/ afaik, future versions 
>ought to via a linux kernel.  http://www.palmsource.com/opensource/
>SDL mailing list
>SDL at libsdl.org
i just want to note that the latest boost library ( www.boost.org ) adds 
a set of iostream classes, that include abstraction for memory mapped 

"Boost.Iostreams has three aims:
To make it easy to create standard C++ streams and stream buffers for 
accessing new Sources and Sinks.
To provide a framework for defining Filters and attaching them to 
standard streams and stream buffers.
To provide a collection of ready-to-use Filters, Sources and Sinks.

For example, Boost.Iostreams can be used to create streams to access TCP 
connections or as a framework for cryptography and data compression. The 
library includes components for accessing

!!!!!!!!!!!! memory-mapped files, !!!!!!!!!!!!!!

for file access using operating system file descriptors, for code 
conversion, for text filtering with regular expressions, for line-ending 
conversion and for compression and decompression in the zlib, gzip and 
bzip2 formats."

"The classes mapped_file_source, mapped_file_sink and mapped_file 
provide access to memory-mapped files on Windows and POSIX systems. "

More information about the SDL mailing list