Click to See Complete Forum and Search --> : global variables


Jessie
August 21st, 2001, 04:42 AM
Hi,
I am using a global variable inside a MFC regular DLL. The problem happens when I close the program. The are hundreds of access violations and points to the destructor of the global variable and "if ( _CRT_INIT(hDllHandle, dwReason, lpreserved) == FALSE )" in DllMain().
Can anybody give me some idea what I should take into account about the global variables in DLL?

thanks in advance
Jessie

amirj
August 21st, 2001, 05:12 AM
Global variable usage is not a good practice of programming but if your variables are pointer, so properly delete them in dll exit application function (Exitinstance) also u can use try...catch block for proper tracing and fixing.

Related keywords:
try...catch
CException class
CMemoryException class
etc.