Some time ago I reported a reason why Ldap module can not work on
Windows and crashes when caching is enabled. It is because shared
memory that is obtained by processes has different base address for
each process.

I thought to replace pointers with offsets everywhere but it became
really ugly. To get any pointer you have to make a function and call
it.
This made me thinking how projects like PostgreSQL which recently has
been ported to Win32 and are very shared memory oriented did it. As a
result I found that there is a function in Win API that allows to map
shared memory with desired base address!

Currently APR uses Win32 API MapViewOfFile(). But there is a
modification of this function, MapViewOfFileEx()
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/mapviewoffileex.asp
which has an additional argument
================================
lpBaseAddress
    [in] A pointer to the memory address in the calling process
address space where mapping begins.
...
    If lpBaseAddress is NULL, the operating system chooses the mapping
address. In this scenario, the function is equivalent to the
MapViewOfFile function.
================================

So, I'm quite sure APR needs to use this function to map shared memory
to the same address in all processes and make win application similar
to unix.

Vadim Chekan.

Reply via email to