1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Dynamic link library Global data.

Discussion in 'C' started by rag84dec, Nov 23, 2008.

  1. rag84dec

    rag84dec New Member

    Joined:
    Jul 17, 2007
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    Hi all,

    What is the meaning of DLL's Global data?.If i have a class with member functions,will any member functions
    and data members qualify for the global data category?.
    How will i make it thread safe?
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Global data in a DLL is exactly what it says, data that is global to the DLL. I'm not sure if it's global to all instances of the DLL (say where three programs are running that each load the DLL); the only time I've done DLL programming was in the Windows 3.x days and I think it might have been. (These days I would expect each process to have separate global DLL data but I'd have to check to be sure.)

    Static member functions will act like global data, just as they do in executables, and like global data are worth avoiding if you want to be threadsafe. If you have to have global/static data, then you will need to mutex access to that data (again, just as you would have to in an executable).
     

Share This Page