It's a complex solution, running an asm-written 64 bit executable in the background, then communicating with it using memory mapped files and windows GDI messages to launch some 64 bit functions from a 32 bit Delphi process.

There is a sample which is able to load any 64 bit library, then call any function of this library, from a 32 bit executable.

Here are the typical steps of this solution:

  • Delphi side creates a memory mapped file, either on disk, either on memory;
  • It creates a mutex to notify file change;
  • It lauchs a small 64 bit executable process, written in plain assembler (less than 5 KB in size!);
  • Delphi client writes some data to the memory mapped file, including the function name and its parameters;
  • Then it notifies the 64 bit background process via a GDI message;
  • The 64 bit process receives the notification;
  • Then it reads the data from the memory mapped file, and unserialize all parameters (including memory buffers);
  • Then calls the 64 bit library;
  • It serializes the answer into the memory mapped file;
  • Then notify the Delphi client via a mutex;
  • Delphi client unserialize the answer;
  • Delphi 32 bit application can use the incoming data.
By design, memory mapped files are fast (it's a kernel-level / x86 CPU feature), and can handle huge memory (up to 1 GB for a 32 bit process, from my experiment).
So it will be slower than direct call from a native 64 bit process, but it will be fast enough to call some low-level 64 bit API, or some custom process needing 64 bit memory.  

This solution seems to work well.
In all cases, code is worth looking at it: it's technical, but well designed!

Link is available at