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. Shared Singleton between EXE and DLL

Shared Singleton between EXE and DLL

Scheduled Pinned Locked Moved C / C++ / MFC
performancehelpquestion
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.
  • J Offline
    J Offline
    Jason Douglas
    wrote on last edited by
    #1

    I'm using a Singleton class for some debugging work, and I have a few DLL's supporting my application. My problem is that I have a separate instance of the Singleton for each DLL and the Application. I would like them to all use the same instance of this variable. Is there some shared memory trick or something that I can implement to get around this? Thanks, Jason

    G 1 Reply Last reply
    0
    • J Jason Douglas

      I'm using a Singleton class for some debugging work, and I have a few DLL's supporting my application. My problem is that I have a separate instance of the Singleton for each DLL and the Application. I would like them to all use the same instance of this variable. Is there some shared memory trick or something that I can implement to get around this? Thanks, Jason

      G Offline
      G Offline
      Ghazi H Wadi
      wrote on last edited by
      #2

      There is an article that will provide you with a work around for your problem. hope it will help you "HOWTO: Alternative Implementation of ATL Singleton" The singleton implementation in this article works around this problem by returning a marshaled pointer in IClassFactory::CreateInstance(). Famous Last Words: "TRUCK!!!"

      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