Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6355365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:45:03+00:00 2026-05-24T22:45:03+00:00

I am looking for a way to coordinate DLLs in the same process, in

  • 0

I am looking for a way to coordinate DLLs in the same process, in order to provide a data sharing mechanism between them. The goal is to have the same sharing code for all DLLs, and to have them coordinate in such a way that the first one loaded by the main program will act as the manager for shared items, while the others will use this manager. I cannot modify the main application, so having that set up the manager and sharing its memory address with the other DLLs is not possible. The set of DLLs using this mechanism can vary, so I cannot assume explicitly that one of them will be loaded.

One solution I considered is to add the memory address to the environment variables of the process. The first DLL would see that the environment variable is not set yet, create the manager object and set the variable to its address. The other DLLs would see the variable and create a pointer to the manager object from that.

This comes close to what I want, but it seems a bit crude, since there is no guarantee that the environment variable isn’t set already for some reason, and SetEnvironmentVariable/GetEnvironmentVariable can fail for various reasons.

Is there a better way to handle this? I’m looking for a way to store and retreive a named pointer in the context of a process, but if you have a better solution for the underlying problem of getting the DLLs to cooperate I’d be happy to accept this as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:45:05+00:00Added an answer on May 24, 2026 at 10:45 pm

    Combine GetModuleHandle() with GetProcAddress() to achieve this. The dependent DLLs will obtain the handle to the manager DLL, and then use GetProcAddress() to retrieve pointers from the symbols that it exports.

    Or just dynamically link the dependent DLLs against the manager DLLs and use a header file for the extern definitions.


    I misread your question initially; however, the above approach can still be useful.

    You can require that these DLLs all export an identical symbol that will point to some structure or function. Then, when one of the libraries is initialized, it can enumerate the loaded modules in the process and look for that symbol. If dereferencing the pointer returned by GetProcAddress() returns a null pointer, then this module is the first one loaded and should create the required structure and set its own variable. Otherwise, it uses the value obtained from the pointer.

    This method is fraught with race-conditions though, if these modules can be initialized concurrently. You would be better off having a single supervisor module that each module can use as a communication point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was currently looking into memcached as way to coordinate a group of server,
I'm looking for way to PHP to detect if a script was run from
I'm looking a way to enable IP logging with log4net in ASP.NET. I found
I'm looking for way to write Javascript programs / scripts on desktop, not inside
I'm looking a way to build conditional assignments in bash: In Java it looks
I am using codeigniter and looking a way to enable directly editting of doc
I am using the jquery-ui-dialog plugin I am looking for way to refresh the
First, I'm not looking a way to parse an RSS-feed. I am creating an
Looking for a way to programatically, or otherwise, add a new instance of SQL
I looking for a way, specifically in PHP that I will be guaranteed to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.