[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

searching for dll in runtime.

Posted on 2011-10-10
6
Medium Priority
?
614 Views
Last Modified: 2012-05-12
Hello
One of our windows C application a.exe is developed in VS .NET 2003 IDE.
In runtime this app a.exe is searching for xyz.dll in
c:\abc folder first
and
C:\def fodler next

I want to make my application a.exe first search in C:\def first.
What should i do for this?
Sham
0
Comment
Question by:mohet01
  • 3
  • 3
6 Comments
 
LVL 9

Expert Comment

by:raysonlee
ID: 36940952
It is not safe to use same DLL name and put different versions in different directories. The system's PATH will determine the search order and there are other factors affect the search order of DLL. e.g. If the DLL is already loaded in memory, it'll not be searched and loaded again even it's in another directory.

Refer to http://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx for more details.
0
 

Author Comment

by:mohet01
ID: 36941550
Hello Rayson
Can't we say abc.exe to search for xyz.dll in particular path using some linker option in Projetc->Properties?
Sham
0
 
LVL 9

Expert Comment

by:raysonlee
ID: 36941580
As stated in the above link, you can set it in your program with SetDllDirectory, refer to http://msdn.microsoft.com/en-us/library/ms686203%28VS.85%29.aspx as well.
However there are changes that the system won't search it at all.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mohet01
ID: 36941697
There is no scope of modifying the code
0
 
LVL 9

Accepted Solution

by:
raysonlee earned 2000 total points
ID: 36943067
Another method is to store the path in registry: http://www.codeguru.com/Cpp/W-P/dll/article.php/c99
0
 

Author Closing Comment

by:mohet01
ID: 36947007
perfect
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question