From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

dll search path

Solved!
Go to solution

Hi,

i am using a dll (created in CVI) in my main project.

i have few project where i am using the same dll. problem is, every project i need to maintain a local copy of the dll which is not intended.

i need to maintain a single copy of the dll and i need to access from that path to all my projects.

 

even thought i have placed it in system 32 folder, my program is showing error as shown below

 

Project link errors
=>Failed to open ecternal module
=>aborted load of library "path\filename.lib"

 

1) is there any setting that i need to change for searching the dll path ?

2) how to tell the program to search the file in particular path? please tell the procedure

 

regards

phani

 

 

 

 

phani srikanth
0 Kudos
Message 1 of 6
(6,520 Views)

I think you are mixing dll and lib. You can place the dll in the system32 folder and it will be used when you run the application. The lib file is used when linking the program. Use add file to project and add the lib file to every project that is using the file for linking. Also configure include to search for the lib header file if required.

0 Kudos
Message 2 of 6
(6,501 Views)

You can read this help page that gives you some basic concepts about DLLs and corresponding LIB files.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 6
(6,497 Views)

Thanks for the response. It was really helpful.

 

I placed the *.dll file in system32 folder and I am able to run without any link errors.

 

I have few doubts in it.

 

I believe that *.lib file (related to *.dll file) should be present in every project I use.

 

1.) if at all I update the *.dll file, do I need to update the *.lib file in all project folder's??

2.) if I want to place that dll file in a separate folder (not system32) what procedure I should follow, so that my project will run without link errors??

3.) how can I use the loadlibrary command, so that I can access DLL's that are in other folders.

 

 

thanks in advance

phani

phani srikanth
0 Kudos
Message 4 of 6
(6,480 Views)
Solution
Accepted by topic author PhaniChillara

 

1) Do not place the lib file in every project folders. If you used the add file to project and added the lib file from the original lib project path, the correct lib file will be used. Remember to replace the old dll in the system32 with the new one. You can configure the project to copy the dll to system32 automatically.

 

2)Windows searches for DLLs several ways. The most common is to search application directory and system32.

 

3) You can add a path to the loadlibrary function (not recommended). If you use loadlibrary, you do not need the lib file, but you have to tell the linker how the functions you need from the dll looks like. This works like a plugin. The dll is not loaded before it is needed. Read documentation closely before using this function

 

 

0 Kudos
Message 5 of 6
(6,473 Views)

Thanks

 

1) configure the project to copy the dll to system32 automatically : under target settings << where to copy DLL,  I have selected Windows system directory. But while building the dll am getting the following error: Failed to copy "dll path" to "C:\windows\system32\testdll.dll" File access permission denied. But I have admin login to the test PC.

 

2)yes. I agree. it is accepting only in two ways for me. I) in the project path and system32 folder.

 

3) OK. Will I get a details procedure(steps to follow)??  do I need to change the code??

 

 

Thanks in advance

phani

phani srikanth
0 Kudos
Message 6 of 6
(6,462 Views)