Memory, pointers, structs problem

Hello, I have problem with my application(s) - win32. I have client and server (nothing connected with net, just names) both have defined same structure. Server application is creating and filling structure and "sending" it to client app by pointer. Why "sending"? There's a point, client app is receiving address to structure but it was created in another application so I cant read what is behind that address. How could I read that structure in client application?
You can't, in general, send a _pointer_ between two applications (either on different machines, or on the same machine) - because applications are deliberately set up to run in their own memory space. This means that when an application is running, it sees only it's own view of the world (memory-wise), and is protected from tromping on anybody else.

There is a mechanism known as "shared memory" which can be set up to allow one block of system memory to be read ("mapped") and/or written by multiple applications on the same machine, but this has to be set up with a bunch of system calls.

In general, to pass a structure from one application to another, usually requires the _bytes_ that make up the structure to be sent across some form of pipe (or file, or shared memory block), and then the structure reconstituted by the receiving application. This gets challenging when the structure contains pointers to other instances of structures...
Last edited on
Okay, that application is: Main Application with plugin - that plugin can call functions from MainApplication and send pointers to structures to it thorugh "Link"(pointer to structure) ( seems logic, plugin is working within MainApplication ). But there is another application that calls functions from MainApplication's plugin. And there's a point. When another application is calling funtion i have to create structure and "send" it to MainApplication. C# has something like invoker when calling from another thread, how about c++? Just pipes?
Last edited on
Sorry, not familiar with C# - hopefully somebody else will be able to answer.
I was wondering, is there any possibility to start another application witin plugin? Like MainApplication and plugin, they can access to each other's memory.
What you are suggesting sounds a bit like remote procedure call (RPC): http://en.wikipedia.org/wiki/Remote_procedure_call

There are probably various libraries that you can use to achieve this or else you would have to write your own framework, but its not trivial.
Topic archived. No new replies allowed.