Click to See Complete Forum and Search --> : Shared variables in sections of Dlls


Tomek.Sergey
July 24th, 2005, 07:42 PM
Hi !
I don't know why, but i cannot cope with realizing of shared sections to store variables in. Please, let us look to this article :
http://www.codeguru.com/Cpp/W-P/system/keyboard/article.php/c5699/

Have anybody tried to make a breakpoint to the function where UnsetWindowsHookEx is called in the article's example?
WARNING : DURING COMPILING ON MY MACHINE I HAVE the hook variable set to NULL !
This procedure is in keydll3.cpp file :

KEYDLL3_API void removehook()
{
UnhookWindowsHookEx(hook); // set breakpoint here and hook var is NULL
}

Please, can anybody compile this example and just see that there is the same situation as I have on my machine ?
As far as i can understand, this snippet does not work :

#pragma data_seg(".HOOKDATA")//Shared data among all instances.
HHOOK hook = NULL;
HWND hwnd = NULL;
#pragma data_seg()