BGNG
New member
My current project has led me to implement a memory object-esque style of manipulation exactly the way things work in Windows GDI: where an object is created in the next available memory and a pointer to it is returned. The question is: how do I do this in C++?
Let's say that I have a data structure, "typedef struct Blah." I want to stash that in the next available piece of system memory, then return a handle to it. I also want to be able to clear it out of memory. The project I'm working on is a DLL that creates any number of such objects into memory for use by the parent application; which may need to use one or more Blah objects. Again, it's like Windows GDI: every time you call "CreateDC," you get a pointer to a new DC object.
Could someone give me some sample code of how to go about doing this?
Let's say that I have a data structure, "typedef struct Blah." I want to stash that in the next available piece of system memory, then return a handle to it. I also want to be able to clear it out of memory. The project I'm working on is a DLL that creates any number of such objects into memory for use by the parent application; which may need to use one or more Blah objects. Again, it's like Windows GDI: every time you call "CreateDC," you get a pointer to a new DC object.
Could someone give me some sample code of how to go about doing this?