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. What if two executable/Dynamic libraries use another common Dynamic library at the same time?

What if two executable/Dynamic libraries use another common Dynamic library at the same time?

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 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.
  • S Offline
    S Offline
    shaktikanta
    wrote on last edited by
    #1

    Let two exes use same dll in windows platform at particular time.Then what is shared internally?Please correct me if I am wrong. -Dll file in Hard disk is shared(Single copy). -Instructions in Dll are loaded once and code can be used by both the executable. -The objects in the Dlls are also shared by both executable. Please clear me - The mechanism in windows os. whether this is same across all OS. Thank you in Advance.

    CPalliniC A 2 Replies Last reply
    0
    • S shaktikanta

      Let two exes use same dll in windows platform at particular time.Then what is shared internally?Please correct me if I am wrong. -Dll file in Hard disk is shared(Single copy). -Instructions in Dll are loaded once and code can be used by both the executable. -The objects in the Dlls are also shared by both executable. Please clear me - The mechanism in windows os. whether this is same across all OS. Thank you in Advance.

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      From MSDN[^]:

      DLLs also help reduce memory overhead when several applications use the same functionality at the same time, because although each application receives its own copy of the DLL data, the applications share the DLL code.

      THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite

      In testa che avete, signor di Ceprano?

      S 1 Reply Last reply
      0
      • CPalliniC CPallini

        From MSDN[^]:

        DLLs also help reduce memory overhead when several applications use the same functionality at the same time, because although each application receives its own copy of the DLL data, the applications share the DLL code.

        THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite

        S Offline
        S Offline
        shaktikanta
        wrote on last edited by
        #3

        @CPAllinii Thank you for answer. But if two dlls(having same signature) in two different directories and linked by tw different executable. Then what will happened? Is the design same across different OS. Please answer. :^)

        CPalliniC A 2 Replies Last reply
        0
        • S shaktikanta

          @CPAllinii Thank you for answer. But if two dlls(having same signature) in two different directories and linked by tw different executable. Then what will happened? Is the design same across different OS. Please answer. :^)

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          I think you may find the answer in this MSDN page: "Dynamic-Link Library Search Order"[^].

          THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite

          In testa che avete, signor di Ceprano?

          1 Reply Last reply
          0
          • S shaktikanta

            Let two exes use same dll in windows platform at particular time.Then what is shared internally?Please correct me if I am wrong. -Dll file in Hard disk is shared(Single copy). -Instructions in Dll are loaded once and code can be used by both the executable. -The objects in the Dlls are also shared by both executable. Please clear me - The mechanism in windows os. whether this is same across all OS. Thank you in Advance.

            A Offline
            A Offline
            Albert Holguin
            wrote on last edited by
            #5

            As far as object data (memory), that's not shared at all.... it's just the code that is shared. For example, if you have two exe's using an IO dll, the state of one will not affect the other, they're still independent while running. If you want them to share something, you have to set that up using other means (IPC).

            1 Reply Last reply
            0
            • S shaktikanta

              @CPAllinii Thank you for answer. But if two dlls(having same signature) in two different directories and linked by tw different executable. Then what will happened? Is the design same across different OS. Please answer. :^)

              A Offline
              A Offline
              Albert Holguin
              wrote on last edited by
              #6

              There's an order by which exe's look for libraries. It will use the first one it finds, I believe CPallini gave you a link that specifies the search order. You can use tools such as Dependency Walker[^] to see what dll specifically is getting loaded by an exe if you're not sure which one it's loading. It is customary that shared dll's are placed in a location where any program that wants to use it has access to it, of course, this will require admin privilidges for your installer (assuming you place the dll copy in a system folder).

              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