Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. need some advice...

need some advice...

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    godbert
    wrote on last edited by
    #1

    Hi guys, I ve got a question, a stupid question maybe... I m making a DLL, with oviously heaps of functions in it. I would like to have a static variable (something that could be modified my some functions). I was wondering if there is nothing dodgy in creating a static variable in a DLL. Since, I dunno how and when exactly the DLL is loaded and unloaded. Is it reloaded each time a function gets called? It s a bit fuzzy to me. Maybe there is nothing special in this but I just wanted to be sure.. Thank u 4 ur help... sysy

    I 1 Reply Last reply
    0
    • G godbert

      Hi guys, I ve got a question, a stupid question maybe... I m making a DLL, with oviously heaps of functions in it. I would like to have a static variable (something that could be modified my some functions). I was wondering if there is nothing dodgy in creating a static variable in a DLL. Since, I dunno how and when exactly the DLL is loaded and unloaded. Is it reloaded each time a function gets called? It s a bit fuzzy to me. Maybe there is nothing special in this but I just wanted to be sure.. Thank u 4 ur help... sysy

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      There are ways a DLL can be loaded. 1/ Implicitly. This is the usual way. It happens if you link to the DLL when you are creating your EXE. When the DLL is loaded, the DllMain function is called, and static variables in that module (DLL) are initialed. This happens once for each process. See DllMain for more detail. 2/ Explicitly. This happens at runtime, by the SDK function LoadLibrary. There are articles on codeproject about DLLs for beginners. I would recommend looking there. Iain.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups