[fpc-pascal] how to pass PChar (or any pointer) from Delphi to FPC ?

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Apr 4 11:18:56 CEST 2006

On 4 apr 2006, at 11:14, Пётр Косаревский wrote:

>> How do you transfer these pointers and what are you trying to
>> accomplish? You generally cannot transfer pointers from one running
>> program to another. It may work by accident in some cases, but it is
>> not something you can rely on (even if both programs are compiled by
>> the same version of the same compiler on the same OS and are running
>> on the same machine).
>> Jonas
> I transfer them as numbers. I work under win32. I transfer them as  
> LParam-s with PostMessage() WinAPI function. Numbers are  
> transferred correctly (I checked it with .messagebox/writeln).
> I try to have access to the same physical memory (I want to have  
> common read-write variable).

Each and every process has its own virtual memory space under win32  
(and most other operating systems). You cannot access the same  
physical memory this way (not in Delphi either), you must use some  
Win32-specific functions to setup a shared memory area and request  
the OS to map it in both processes. I don't know how to do this on  


PS: in general always reply to the mailing list, unless people  
explicitly ask not to do that.

More information about the fpc-pascal mailing list