Return to Snippet

Revision: 24483
at March 2, 2010 13:37 by jimfred


Initial Code
#pragma data_seg(".myShared")
#pragma comment(linker, "/SECTION:.myShared,RWS")
int shared = 1; // goes in .myShared. Must be initialized.
#pragma data_seg() // revert to default

Initial URL

                                

Initial Description
myShared is an arbitrary name. It must not collide with names .bss etc (see /SECTION in MSDN).

RWS indicates Read/Write/Shared. (See /SECTION in MSDN)

Avoid sharing process-specific info such as pointers, HANDLEs etc.

Won't work with Vista Services.

Initial Title
C++, DLL, shared memory using pragma without touching .DEF file

Initial Tags

                                

Initial Language
C++