Windows 3.1 does not support task-based global variables in DLLs. These modules helps implementing task-global variables in DLLs. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³entry table (DLL local heap)³ ÚÄÄ>³data entry 1 (global memory) ³ ³ ³ ³ ³ magic cookie ³ ³ task handle 1 ³ ³ ³ "global" variable 1 ³ ³ far pointer 1 ³ÄÄÄÙ ³ "global" variable 2 ³ ³ task handle 2 ³ ³ ³ ³ far pointer 2 ³ÄÄÄ¿ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ task handle 3 ³ ³ ³ far pointer 3 ³Ä¿ ÀÄÄ>ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ... ³ ³ ³data entry 2 (global memory) ³ ³ ... ³ . ³ magic cookie ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ . ³ "global" variable 1 ³ . ³ "global" variable 2 ³ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ When a task the first time request a pointer to its global data with getInstanceRTLData(), the DLL creates an entry with GlobalAlloc(). The global memory handle will be owned by the calling task. The second time the task calls getInstanceRTLData(), it will receive a pointer to the global memory that was previously allocated. When a task terminates Windows will automatically free the the global memory allocated by the task including the global memory containing the "global" variables. The DLL will at a later time discover that the memory has been freed and will delete the entry in its table.