Article View: comp.os.ms-windows.programmer.misc
Article #2686C++ static data member in DLLs
From: Hungtau Ting
Date: Mon, 11 Jan 1993 15:17
Date: Mon, 11 Jan 1993 15:17
39 lines
2013 bytes
2013 bytes
Hi, The C++ static data in DLLs does not work properly as stated in Borland C++ Programmer's Guid, page 336: Through a DLL's functions, all applications using the DLL have access to that DLL's global data. A particular function will use the same data, regardless of the application that called it. If you want a DLL's global data to be protected for use by a single application, you would need to write that protection yourself. The DLL itself does not have a mechanism for making global data available to a single application. If you need data to be private for a given caller of DLL, you will need to dynamically allocate the data and manage the access to that data manually. Static data is global to all callers of a DLL. If I'm going to "write that protection myself" everytime I need to use static data members in a class, then the C++ programming for DLL is severe handicapped. Since our UI is built with Visual Basic (v2.0) which only works with DLLs, and was ported from SUN UNIX/C++ (a lot of static data), we have no choice but to "write that protection ourselves". My guestion is what is most effective way of re-implementing many static data members into something acceptable in DLL. Someone out there in the netland should have delt with this problem already. So, If you're the someone, would you please email me any info that might help? Thanks, Hungtau Ting Software Engneer XAIT ting@xait.xerox.com
Technical Details
Message-ID:
<1993Jan11.151759.10674@XAIT.Xerox.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!howland.reston.ans.net!paladin.american.edu!gatech!destroyer!ncar!hsdndev!xait!tingShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!howland.reston.ans.net!paladin.american.edu!gatech!destroyer!ncar!hsdndev!xait!ting From: ting@Redwood.XAIT.Xerox.COM (Hungtau Ting) Newsgroups: comp.os.ms-windows.programmer.misc Subject: C++ static data member in DLLs Keywords: C++, DLL, VB Message-ID: <1993Jan11.151759.10674@XAIT.Xerox.COM> Date: 11 Jan 93 15:17:59 GMT Sender: ting@XAIT.Xerox.COM (Hungtau Ting) Reply-To: ting@Redwood.XAIT.Xerox.COM (Hungtau Ting) Organization: Xerox Advanced Information Technology, Cambridge, MA Lines: 39