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

  • Home
  • SEARCH
  • 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 4111924
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:07:43+00:00 2026-05-20T22:07:43+00:00

In the DllMain Entry Point documentation , the author makes the following comment: To

  • 0

In the DllMain Entry Point documentation, the author makes the following comment:

To provide more complex initialization, create an initialization routine for the DLL. You can require applications to call the initialization routine before calling any other routines in the DLL.

In C/C++, how do I create a different routine and require the application to call it before any other?

  • 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-20T22:07:43+00:00Added an answer on May 20, 2026 at 10:07 pm

    The initialization routine can be any exported function. The trick is the “requiring other applications to call it”. To enforce it, you would need to check if it had been called in pretty much every other exported function. If each exported function has some common prefix code, that would be a good place to check if the initialization function had been called.

    If, though, you have to check if it has been called in every single entry point, it might be easier on the consumers of the DLL if you actually call that function automatically if it has not been called. That does require some additional work in making it thread safe most likely. You would need a critical section (or mutex, semaphore, etc.) to ensure that it was only called one time.

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

Sidebar

Related Questions

When you create a DLL you can get notifications about new threads / exiting
When my MFC DLL is loaded a class is instantiated in dllmain . How
I want to have a static global std::unordered_map in the cpp of my entry
So I've got an application that starts another application with my DLL injected (with
I have an unmanaged C++ MFC dll that was developed in VS 6.0. I
I'm writing a DLL that needs to call a separate DLL dynamically multiple times.
I have written a C DLL and some C# code to test including this
I would like to have a DLL with window creation and management code in
I have a Dllmain that allocates Thread local storage when a thread attaches to
I am compiling a DLL twice (once for x86, once for x64) and I

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.