This forum has been archived. Please start a new discussion on GitHub.

Multithreaded DLL

I would like to create a multithreaded DLL in VC++ or C++. What is the standard approach to developed multithreaded dll's in C++ or VC++?

I have created a DLL (i.e. MFC App Wizard DLL). In that DLL I have created one class that contains some validation logic and created one ThreadPool class.

At the time of DLL loading (DLL constructor) I have created some number (for example 2) of threads and deletes those threads at time of DLL unloading (DLL destructor).

In that DLL I exported one function. This function takes the input from the client data, creates the object to validation class and assigns the user data to the validation object and placed that validation object in the Thread Pool queue and signals the threads about work arrived. Then free thread picks this and validates the user request and returns the result.

Code is working fine. But here the problem is every client loading the DLL in to his address space in that situation every time DLL is creating the threads.

But I need a dll that will be in the memory and it has to take requests from the clients and assigns to the different threads. DLL has to create thread only one time instead of creating threads every time when client loads the DLL.

I want to create the threads at one time only.

If any body familiar about Multithreaded DLLs could you please send me the reply. It is very helpful to me.


  • marc
    marc Florida
    Sorry, but these forums are for Ice-specific questions only. Please contact Microsoft support or use one of the Visual C++ mailing lists or newsgroups for general questions about DLLs.

    Also, please see this thread in case you have any Ice-specific questions.
This discussion has been closed.