CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 1999
    Posts
    56

    global variables

    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


  2. #2
    Join Date
    Aug 2001
    Location
    Karachi, Pakistan
    Posts
    14

    Re: global variables

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured