LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading the same dll into separate memory spaces

Hi,

I have dlls that are responsible for managing devices. Each dll manages one device. I want to be able to load the same dll into different memory spaces to handle having multiple of the same device.

I am trying to avoid having the dll know that there are multiple devices and managing the connection to all of them.

Thanks for your input.
0 Kudos
Message 1 of 3
(3,366 Views)
Hello,

You will be able to implement a solution close to what you describe, but not exactly as stated in your post.
The LoadLibrary SDK function is used to load and unload DLLs programmatically. You can find more documentation on this function in this document on MSDN.

As you can see in the documentation there is a limitation with loading the a DLL with the same name multiple times: "Two different modules cannot have the same file name, even if the extensions are different. These effectively have the same module name. For example, if LoadLibrary is made on Sample.cpl, the operating system will not load Sample.cpl, but instead will again load Sample.dll."

If you create a separate DLL file for each instance you would like to open you can use something similar to what is described in Knowledge Base 2EIBT1Y1 to create function pointers that will allow you to execute a function in each DLL.

Scott Y
NI
0 Kudos
Message 2 of 3
(3,340 Views)
Thanks for the help.
0 Kudos
Message 3 of 3
(3,334 Views)