Gold mine of Visual C++ tricks!
- Announcements (6)
- C++ (31)
- Codeproject (106)
- COM (1)
- Compiler Extension (3)
- Debugging Tips (17)
- FileSystem (2)
- GDI & GDI+ (5)
- Glorious Bugs (3)
- MFC (22)
- Misc (2)
- Networking & Winsock (1)
- Polls (2)
- Preprocessors (3)
- Project settings (6)
- Uncategorized (47)
- VC++ Debugging Tips (1)
- Visual C++ (13)
- Visual C++ Preprocessors (1)
- Visual Studio (9)
- Visual Studio Tools (2)
- Windows APIs (35)
- Windows Shell Pearls (4)
#pragma #pragma comment array Breakpoint C++ catch(...) ColorHLSToRGB() ColorRGBToHLS() cout crash CRT Debugging exceptions exe File path FindFirstFile() functor gdi+ GetDlgCtrlID() handle hide file HLS Hue library macros memory leaks MINMAXINFO modules MoveFileEx name mangling new NTFS PathRemoveFileSpec() preprocessor Project settings SendMessage Shlwapi.h Shlwapi.lib STL unhandled exception VC++ Visual C++ Visual Studio Visual Studio 2008 watch window- March 2010 (1)
- February 2010 (7)
- November 2009 (2)
- October 2009 (3)
- July 2009 (1)
- June 2009 (1)
- May 2009 (2)
- April 2009 (2)
- March 2009 (9)
- January 2009 (7)
- December 2008 (12)
- November 2008 (5)
- October 2008 (6)
- September 2008 (2)
- August 2008 (13)
- July 2008 (17)
- June 2008 (24)
- May 2008 (29)
- April 2008 (33)
- March 2008 (20)
- February 2008 (1)
- Microsoft MVP for Visual C++ for 2009-2010 (16)
- Is it outlook, who composes your "New Message"? (12)
- Name Mangling – How to Undecorate a decorated C++ function name. (10)
- How to Parse Virtual Table? (9)
- How to import dialogs or resources from one project to another? (8)
- How to blink LED's in Keyboard? (8)
- Happy Birthday! WeSeeTips!!! (8)
- How to check whether current user have administrator privilege? (7)
- How to set title for your console application window. (7)
- Trigraph char sequences in C & C++ (6)
Jijo Raj: Thanks Raj. Thanks for those kind words! Best Regards, Jijo.
rajkumar: this web site is simple super.
eran: Sounds like a trick you should try to avoid, due to race condition issues. Theres a chance that...
Divin: Cool tip. saved alot of time :-)
Jijo Raj: Thanks Sarath. Sure, i'll keep a backup. Thanks for the tip! Regards, Jijo.
Shiva: Jijo, New theme is simple and good. Suggestion: It'd be better if u make 'Archives' widget's...
shi: Hello, Could you also explain what the meaning is of the return value? Thanks!
sarath: It's nice to see the new home with a reloaded theme. Ensure the proper backup f your website. I've...
How to share data between different instance of same DLL?
May 4th
Posted by Jijo Raj in Codeproject
2 comments
Usually Dlls are loaded into its corresponding process address space. Indeed the code is shared between all instances but not the global data. So the issue that we might face is – how can we share common data between all dll instances?
You’ve to declare your own shared data segment in your dll. You can use #pragma data_seg() to declare your own data segment. See the sample code snippet below.
#pragma data_seg (".MYSEG") int g_nInteger = 0; char g_szString[] = "hello world"; #pragma data_seg() // Tell the linker that the section // .MYSEG is readable, writable and is shared. #pragma comment(linker, "/SECTION:.MYSEG,RWS")Here we are declaring our data segment and are telling that, this segment is RWS – readable, writable and shared. This way we manage to share this data segment between all dll instances.
Targeted Audience – Intermediate.