home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4834 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  1.9 KB

  1. Path: sparky!uunet!usc!howland.reston.ans.net!paladin.american.edu!gatech!destroyer!ncar!hsdndev!xait!ting
  2. From: ting@Redwood.XAIT.Xerox.COM (Hungtau Ting)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: C++ static data member in DLLs
  5. Keywords: C++, DLL, VB
  6. Message-ID: <1993Jan11.151759.10674@XAIT.Xerox.COM>
  7. Date: 11 Jan 93 15:17:59 GMT
  8. Sender: ting@XAIT.Xerox.COM (Hungtau Ting)
  9. Reply-To: ting@Redwood.XAIT.Xerox.COM (Hungtau Ting)
  10. Organization: Xerox Advanced Information Technology, Cambridge, MA
  11. Lines: 39
  12.  
  13. Hi,
  14.  
  15. The C++ static data in DLLs does not work properly as stated in Borland C++
  16. Programmer's Guid, page 336:
  17.  
  18.     Through a DLL's functions, all applications using the DLL
  19.     have access to that DLL's global data.  A particular function
  20.     will use the same data, regardless of the application that
  21.     called it. If you want a DLL's global data to be protected for
  22.     use by a single    application, you would need to write that
  23.     protection yourself.
  24.  
  25.     The DLL itself does not have a mechanism for making global data
  26.     available to a single application.  If you need data to be private
  27.     for a given caller of DLL, you will need to dynamically allocate
  28.     the data and manage the access to that data manually.  Static data
  29.     is global to all callers of a DLL.
  30.  
  31. If I'm going to "write that protection myself" everytime I need to 
  32. use static data members in a class, then the C++ programming for DLL
  33. is severe handicapped.
  34.  
  35. Since our UI is built with Visual Basic (v2.0) which only works with DLLs,
  36. and was ported from SUN UNIX/C++ (a lot of static data), we have no choice
  37. but to "write that protection ourselves".  My guestion is what is most
  38. effective way of re-implementing many static data members into something
  39. acceptable in DLL.
  40.  
  41. Someone out there in the netland should have delt with this problem already.
  42. So, If you're the someone, would you please email me any info that might
  43. help? 
  44.  
  45. Thanks,
  46.  
  47. Hungtau Ting
  48. Software Engneer
  49. XAIT
  50.  
  51. ting@xait.xerox.com
  52.