Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load a DLL More Than Once?

Tags:

People also ask

Can you load the same DLL twice?

You can not load the same DLL multiple times into a single process (or not and have any effect). If you make the DLL a COM host and use COM objects then this will be automatically handled by each class instance.

What happens when a DLL is loaded?

Every process that loads the DLL maps it into its virtual address space. After the process loads the DLL into its virtual address, it can call the exported DLL functions. The system maintains a per-process reference count for each DLL. When a thread loads the DLL, the reference count is incremented by one.

Can DLL have multiple classes?

Yes U can build as many classes as u want into a Single Dll. Select Visual C# or ur desired language and then in the right pane Select Class Library. Give the Class Library a name and then click on OK. Now add as many classes as u want in this project and when ur done with adding all the classes build the project.


I'm using the LoadLibrary function to load a DLL in Windows. My question is this: If I call this method more than once for the same DLL, do I get handles to different instances of the DLL, or will they all refer to the same instance?

Additionally, how does this behaviour correlate to Linux SO files, is it the same or completely different, and what assumptions can I make in this regard? Thanks.