allocating object in global storage
-
I am doing interprocess communication bwtween a, DOS console program and a windows program using named pipes I need to allocate an object that will remain active while communication is going on between the DOS consile app and the Windows I know that typically object is allocated on the stack E.g however if I use the new operator would that Leave the object alkocated until I do a delete
-
I am doing interprocess communication bwtween a, DOS console program and a windows program using named pipes I need to allocate an object that will remain active while communication is going on between the DOS consile app and the Windows I know that typically object is allocated on the stack E.g however if I use the new operator would that Leave the object alkocated until I do a delete
-
I am doing interprocess communication bwtween a, DOS console program and a windows program using named pipes I need to allocate an object that will remain active while communication is going on between the DOS consile app and the Windows I know that typically object is allocated on the stack E.g however if I use the new operator would that Leave the object alkocated until I do a delete
what type of object are you talking about, is it class-object or any primitive type. in both case you can take services of auto_ptr and stl::list class to keep you object alive between communication and once your program exit, stl and auto_ptr will take care of destruction of your object.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You
-
I am doing interprocess communication bwtween a, DOS console program and a windows program using named pipes I need to allocate an object that will remain active while communication is going on between the DOS consile app and the Windows I know that typically object is allocated on the stack E.g however if I use the new operator would that Leave the object alkocated until I do a delete
You will need to look at the various ways of sharing data between processes, it can be a little complicated. When you use the new opperator you are allocating storage on the heap, however each process has its own heap, and the addresses in one process' heap and not usually accessible to another process, but the can be done using interprocess messaging. Windows hooks are another very powerful way for processes to share memory, but there is no 'global' memory in windows. And yes, you need to use delete to free the memory.
============================== Nothing to say.
-
You will need to look at the various ways of sharing data between processes, it can be a little complicated. When you use the new opperator you are allocating storage on the heap, however each process has its own heap, and the addresses in one process' heap and not usually accessible to another process, but the can be done using interprocess messaging. Windows hooks are another very powerful way for processes to share memory, but there is no 'global' memory in windows. And yes, you need to use delete to free the memory.
============================== Nothing to say.
-
I am not looking for a method of communicationg between process for that I am using named pipes What I am looking for is persistent storage storage that will remain allocated between the interprcess communocation calls
Dude, I'm sure *you* know what you're talking about but it's not coming through in your posts. You have 2 programs, a "Client" and a "Server" using pipes. You have a "System" where these two program are running. Where do you want this "persistent" object to live, in one program or the other or in the operating system (Windows)? What do you want this object for? Depending on what you are going to do with the object, some objects are better than others. Unless you are clear as to what you want it for and where it's to live, you will get some pretty unstatisfying suggestions, like "Open a file, that'll persist"
-
I am not looking for a method of communicationg between process for that I am using named pipes What I am looking for is persistent storage storage that will remain allocated between the interprcess communocation calls
OK, use 'new' and 'delete' (malloc and free) for persistent storage, or you can declare global storage during the life of the process by declaring a global array (you declare it outside of any functions normally just after where you include header files).
============================== Nothing to say.