how to pass PChar (or any pointer) from Delphi to FPC ?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

how to pass PChar (or any pointer) from Delphi to FPC ?

Пётр Косаревский
I can transfer information from Delphi program to FPC, but they have different memory managers or something, so pointers are the same numbers, but different physical addressed.
It doesn't sound extraordinary, so, please, help with example or anything!
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: how to pass PChar (or any pointer) from Delphi to FPC ?

Jonas Maebe-2

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

> I can transfer information from Delphi program to FPC, but they  
> have different memory managers or something, so pointers are the  
> same numbers, but different physical addressed.
> It doesn't sound extraordinary, so, please, help with example or  
> anything!

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_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: how to pass PChar (or any pointer) from Delphi to FPC ?

Alexey Pavluchenko
In reply to this post by Пётр Косаревский
Hello Пётр,

Tuesday, April 04, 2006, 11:48:33 AM, you wrote:

ПК> I can transfer information from Delphi program to FPC, but they
ПК> have different memory managers or something, so pointers are the
ПК> same numbers, but different physical addressed. It doesn't sound
ПК> extraordinary, so, please, help with example or anything!

Maybe the memory-mapped files will help. Look up WinAPI reference for
CreateFileMapping and related functions.

--
Best regards,
 Alexey


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re[2]: how to pass PChar (or any pointer) from Delphi toFPC ?

Пётр Косаревский
> ПК> I can transfer information from Delphi program to FPC, but they
> ПК> have different memory managers or something, so pointers are the
> ПК> same numbers, but different physical addressed. It doesn't sound
> ПК> extraordinary, so, please, help with example or anything!
>
> Maybe the memory-mapped files will help. Look up WinAPI reference for
> CreateFileMapping and related functions.

Thank you, it seems to be correct way to do what I want.


Sorry for generally windows programming question in this mail list.

But what we know: maybe an unit, implementing such functionality OS independent (with Windows.CreateFileMapping under windows and something else under something other) would not be useless?
But it's rather developers' question.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Re[2]: how to pass PChar (or any pointer) from Delphi toFPC ?

Felipe Monteiro de Carvalho
On 4/4/06, Пётр Косаревский <[hidden email]> wrote:
> Sorry for generally windows programming question in this mail list.
>
> But what we know: maybe an unit, implementing such functionality OS independent (with Windows.CreateFileMapping under windows and something else under something other) would not be useless?
> But it's rather developers' question.

This kind of thing doesn´t need to be on the runtime library or other
core parts.

You can implement it as a group of units that someone can just link to
in his programs.

You just need to choose something abstract enougth to be easely
implement on Windows and then on Linux. For an example of a component
that does it, take a look at TrayIcon located at /components/trayicon
on Lazarus.

--
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal