I
I
ipivkin2015-01-28 12:24:22
linux
ipivkin, 2015-01-28 12:24:22

How to put a pointer into Shared memory in Linux?

Good afternoon!
I'm trying to implement interprocess communication via Shared memory in Linux. I ran into a problem when exchanging pointers.
The address space of each process is different and the address of a pointer in one process will not match the address in another. I understand it. It is necessary to implement a relative offset, but I have no idea how to do it.
Share an example! You are welcome

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AxisPod, 2015-01-28
@AxisPod

Are you kidding me?
You can never put pointers in Shared memory, never at all. You can store only bare data, sufficient for full interpretation. You can organize your storage there based on offsets, but there shouldn't be any pointers there, and it's better not to create objects there either. Imagine that you can work with a file with random access and no more.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question