I'm new to memory mapping, what I want to do is to share a map file between many threads, for that I need to create the map file and use the function: MapViewOfFile
so every thread can access to a part of the file, of course I need to send the offset of the view to each thread that respects allocation granularity. But the part that I don't understand is: dwFileOffsetHigh & dwFileOffsetLow.
MSDN says:
The combination of the high and low offsets must specify an offset within the file mapping.
So how can I set the values of these two parameters in a way that they can specify the right offset. Do I need to make any calculations or just use variables and the system handles the rest (Finding the offset) ?, I'm really stuck with this, and every time I make a try I get an exception. So assuming that I know the offset and the size of each view, how can I possibly know the values of these too parametres? An example is worth a thousand explanations. And here is an explanation of what I'm trying to do:
// The main thread create map file and specify the view for every worker thread:
WorkerThreads[i] := WorkerThread.create(...,bloc_offset,bloc_size,...); // So each worker writes in a specified view.
//The worker thread then opens the view and writes data in:
data := mapViewOfFile(mapfileH, FILE_MAP_WRITE, dwFileOffsetHigh, dwFileOffsetLow, blocSize);`
Thanks for answering.