FPC Win32 memory mapped files for IPC

I have just recently started doing some work in win32 - my previous
programming has been with Unix.

I want to share memory between two processes and use free Pascal to do
it.

I first read some old documentation that led me to believe that DLLs
would be the answer - they are required, but the code is copied into
each process that rather defeats the object of a shared library.

So, I now realise that I need to use memory mapped files,
createfilemapping, openfilemapping and mapviewoffileex - so that I can
map the file (actually the pagefile) to my variable space and have the
inter-process data sharing that I need. The only example I can find is
in c, on the ms site.

Surely people are doing this in free Pascal all the time? Does anybody
have some sample code that simply arranges for the global variables in
the DLL to be available as shared memory to all processes using the DLL?

If anybody has an example, or any better suggestions, please let me
know.

--
Great men are almost always bad men.
Lord Acton