Thread: Windows dll questions

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    1

    Windows dll questions

    I've searched the web and found a lot of somewhat related questions but it's been hard to come up with a complete answer to my question.

    My situation is that I've got a web server that loads a dll that I can put some code into. This dll code receives a message when one arrives and what I would like to do is to be able to put it in a queue and then access it from an external .exe for processing.

    So to view this visually here is what I've got:
    webserver.exe -> service.dll <- translatingApp.exe

    So the obvious answer might be to create a singleton in the dll that has a handofflist of messages that I can pick up from the translatingApp. My concern is am I going to end up with each application with their own global instance of this handofflist.

    What I'd like to avoid is using the Windows only memory sharing functionalities because eventually I want to support linux.

    I am looking for any thoughts/explanations of singletons and or static objects in .dlls as well as any good ideas for solving this issue whereby I don't have control over 1/2 of my dll sandwich.

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Ok a singleton would not help you at all. A singleton is just a design (anti)pattern to restrict the creation of instances of a class. And since a DLL normally is loaded into the address space of the calling process the data is not retained in the dll when you try to use it with translatingApp. There are however ways you can do it, MSDN has a few articles on this:
    How do I share data in my DLL with an application or with other DLLs?
    Managing Memory-Mapped Files

    And I would suspect that named pipes could be a way for you to provide the communication aswell, the dll writes to the pipe and the application reads from the pipe:
    Named pipe - Wikipedia, the free encyclopedia
    Named Pipes (Windows)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A few questions about 64 bit and Windows...
    By yaya in forum Tech Board
    Replies: 9
    Last Post: 08-28-2008, 08:49 AM
  2. New to Windows programming, but a few early questions...
    By SkyRaign in forum Windows Programming
    Replies: 5
    Last Post: 12-19-2005, 01:00 PM
  3. questions about windows 2000
    By Unregistered#2000000 in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 07-23-2002, 12:13 AM
  4. Several C++ and Windows questions.
    By sean in forum Windows Programming
    Replies: 2
    Last Post: 01-13-2002, 04:28 PM
  5. A few Windows prog questions
    By Garfield in forum Windows Programming
    Replies: 10
    Last Post: 11-05-2001, 07:06 PM