29 Nov
2010
29 Nov
'10
9:09 p.m.
Ion GaztaƱaga wrote:
On 29/11/2010 19:05, Jeff Flinn wrote:
The following appears to throw an interprocess_exception with boost_1_44_0 compiled with MSVC8 running on windows XP.
using namespace boost::interprocess;
file_mapping fm("empty.txt", read_only); mapped_region mr( fm, read_only);
Is there a reason I can't just get back a null address and zero size?
It's common practice not to support empty mappings. Windows mapped files don't support an empty file. In Unix, mapping zero bytes is an error:
http://www.opengroup.org/onlinepubs/009695399/functions/mmap.html
"If len is zero, mmap() shall fail and no mapping shall be established"
Thanks Ion. I'll just deal with the exception appropriately then. Jeff