SDL icon indicating copy to clipboard operation
SDL copied to clipboard

Proposal: SDL_MemoryMapFile

Open kieselsteini opened this issue 1 year ago • 23 comments

Hello there,

I've a small proposal for SDL3 here. There is the already well known SDL_LoadFile function which comes in very handy. But it would be also very handy, to have a similar function to effectively memory map a file. On most Unix systems this can be achieved with the mmap syscall and on Windows there is CreateFileMapping.

The signature of the function could look like:

const Uint8* SDL_MemoryMapFile(const char *filename, size_t *datasize)

Of course this will memory map the requested file as read only.

I can try to implement a first version of this feature, but I've no Windows box to test it.

kieselsteini avatar Sep 25 '24 11:09 kieselsteini