Jump to content
  • Advertisement
Sign in to follow this  
LEPT0N

How to specify local location of dll's in VS2005?

This topic is 4135 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm making a C++ program in Visual studio 2005. I know how to specify the location of my .lib's I'm using with Project Properties -> Linker -> General -> Additional Library Directories And I know how to specify the location of other header files using Project Properties -> C/C++ -> General -> Additional Include Directories However, I can't for the life of me figure out (through searching through VS and the internet) how to specify what local folder for the program to look for the dll's I'm using. Is it possible for me to specify this, or do I need to have the dll's in the same directory as my executable? I ask this because I'd like to put the dll's into a local directory labelled "dlls" or something like that. Thanks in advance for any help with this issue!

Share this post


Link to post
Share on other sites
Advertisement
You simply can't. The system will search for dlls in a defined order, e.g. it searches all directories that are stored in the PATH variable, the application folder and the system folder [edit]and the current directory[/edit].

In order to support loading DLLs from other folders, you will either have to add these folders to the PATH or load them manually if don't want to change to path.

[edit]
You will find more information at MSDN.
[/edit]

HTH,
Pat.

Share this post


Link to post
Share on other sites
Most simply, your dll path is relative to your app, so I have:

app.exe
(folder)dlls
(folder)meshes
(folder)textures

etc

the my dll is loaded with

dlls\\mydll.dll

Share this post


Link to post
Share on other sites
Quote:
Original post by sipickles
Most simply, your dll path is relative to your app, so I have:

app.exe
(folder)dlls
(folder)meshes
(folder)textures

etc

the my dll is loaded with

dlls\\mydll.dll


That's exactly what I want to do, but how did you do it?

Share this post


Link to post
Share on other sites
Go to Project->Properties->Configuration Properties->Working Directory, enter or browse the directory containing your DLL's.

This will obviously change your working directory, it is the equivalent of going into cmd, CD into the dll directory and call the executable from there, so if your program takes paths as arguments, change them accordingly, if your program makes use of external resources (which probably does) make sure to change the links to them accordingly as well, or move the files relative to the new working directory.

There is also a function to change the current directory programatically, chdir, but unless you're using LoadLibrary() to load your DLLs (call chdir before LoadLibrary), it wont help you much.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!