Is there any reasons to not use "mmap" to read files?

Temtaime temtaime at gmail.com
Sun Feb 6 18:33:59 UTC 2022


On Sunday, 6 February 2022 at 18:14:51 UTC, rempas wrote:
> On Sunday, 6 February 2022 at 16:45:59 UTC, Ali Çehreli wrote:
>> [...]
>
> Oh, this small...
>
>> [...]
>
> Thank you! I will have that in mind in case I want to do 
> something like that in the future. In my use-case tho, I will 
> read the whole file.
>
>> [...]
>
> "mmap" is a system call that doesn't exist (natively) on 
> Windows. I don't know what D does with Phobos (which I'm not 
> gonna use anyway) but even if it works (how?), I will end up 
> creating my own library so I'm in the same spot. "madvise" 
> seems cool, I'll check it out! Thanks! In the end, I like 
> advising and telling others how to do their work, XD!

Windows has its own API to mmap files. There's no need to 
reinvent the wheel, phobos MmFile works for me without any 
problems.
Maybe there's no flush function, but for my use cases it's not so 
critical.


More information about the Digitalmars-d mailing list