Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All

I have created one pointer in one application,Now How to use this pointer in another
same application.

Please suggest how share pointer between two same process?

Thanks
Posted

1 solution

You cannot. Otherwise anyone can alter the data of whatever other running applications. Imagine what can I do by lurking your memory seeking for credit card numbers, and so on...

A pointer points to an address whose value is valid only inside the process that actually allocated it.
Another process (no matter if is identical or not to the first) see a different address map, and may even have pointers to a same address effectively pointing to completely different variables.

You can use "shared memory" between two processes, but it will be represented by different pointers.
To deal with this stuff you have to work with Interprocess communication[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900