I am using shared memory to share objects between a dll and another application.
I must use strings as a data member of the instance of a class, in the shared memory.
I use the CreateFileMapping/MapViewOfFile method, to share the memory. It works fine, with basic data type members.
But with strings, I have problems. First I tried to represent my strings as CString object.
It wasn't good, so I tried the std:string stuff.
But Visual C detected memory leaks after running. But none of the strings were declared dinamically!!!!
And only the strings stayed in the memory.
This happens only, if they are in the shared memory.
So I tried char *. It worked at the "server" app, I could allocate char arrays, I could free them, fine.
But when the dll tried to read from the memory, where the char pointer pointed, not the right data was read.
It got the pointer, but it read wrong data.
How can I solve any of these problems?
Or some method to represent character arrays (or string),
that works between the dll and the app?
I have no idea, where to start now. :((