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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. DLL question

DLL question

Scheduled Pinned Locked Moved C / C++ / MFC
questionperformance
4 Posts 3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    According to MSDN: Every process that loads the DLL maps it into its virtual address space. After the process loads the DLL into its virtual address, it can call the exported DLL functions. Suppose a process starts and at some stage it dynamically loads a dll. A second process also load the same dll. Now what actually happened ??? Do each of these processes share the same chunk of memory where dll is loaded or dll code is loaded at two different locations for both of these processes ???

    V 1 Reply Last reply
    0
    • L Lost User

      According to MSDN: Every process that loads the DLL maps it into its virtual address space. After the process loads the DLL into its virtual address, it can call the exported DLL functions. Suppose a process starts and at some stage it dynamically loads a dll. A second process also load the same dll. Now what actually happened ??? Do each of these processes share the same chunk of memory where dll is loaded or dll code is loaded at two different locations for both of these processes ???

      V Offline
      V Offline
      Vimal Earnest
      wrote on last edited by
      #2

      Yes, the two processes share the same chunk of memory. ~ Vimal

      D 1 Reply Last reply
      0
      • V Vimal Earnest

        Yes, the two processes share the same chunk of memory. ~ Vimal

        D Offline
        D Offline
        defrag08
        wrote on last edited by
        #3

        Vimal Earnest wrote: Yes, the two processes share the same chunk of memory. Suppose the function exposed by the dll has some static variable. Now what happens in this case...whether both applications that are using this dll share single copy of variable ???

        V 1 Reply Last reply
        0
        • D defrag08

          Vimal Earnest wrote: Yes, the two processes share the same chunk of memory. Suppose the function exposed by the dll has some static variable. Now what happens in this case...whether both applications that are using this dll share single copy of variable ???

          V Offline
          V Offline
          Vimal Earnest
          wrote on last edited by
          #4

          What happens is, the COW (Copy On Write) mechanism is used by the system to make a private copy of these variables. To be specific, the system makes a private copy of the memory section containing static and global variables in the process modifying these variables. refer chapter 19 (DLL basics) of Jeffrey Richter's Programming Applications for Microsoft Windows 4th ED for more info. ~ Vimal

          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