is static data shared between processes 
Author Message
 is static data shared between processes

HI!
My question is: if I have a static variable  V = 0 in a class, and this
class after a certain operation does V++, and
then another process creates an instance of the same class, would the value
of V be equal to 0 or 1?
Thank you.
Maksim.


Tue, 21 Sep 2004 00:44:53 GMT  
 is static data shared between processes

Quote:
>My question is: if I have a static variable  V = 0 in a class, and this
>class after a certain operation does V++, and
>then another process creates an instance of the same class, would the value
>of V be equal to 0 or 1?

Maksim,

Another process will have its own variable, so it will be 0.

If you want to share data you have to manage it specially using some
interprocess mechanism such as memory mapped files. Have a look at
Knowledge Base article Q100634 "HOWTO: Specify Shared and Nonshared
Data in a DLL" which documents using #pragma data_seg.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.



Tue, 21 Sep 2004 01:42:10 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. using static data in shared libraries

2. sharing data between processes

3. Multiple processes sharing data space. --- HELP

4. sharing data between processes

5. Sharing data between processes

6. Sharing data between processes

7. Sharing data between processes

8. ??? Process Shared DLL and Data ???

9. sharing variables accros processes & process starting

10. DLL with shared data/class not sharing...

11. Common areas/common data/data sharing

12. How to exchange data between ISAPI process and Application Process

 

 
Powered by phpBB® Forum Software