Hi there,
I have about 20 .dll-files in my output directory now and I would love to put them in a subdirectory called DLL. Is it anyhow possible, to move all DLLs needed by my application into a subdirectory? If yes: how? *g*
Thx in advance,
Emmeran
Moving DLL's
-
haffax
- OGRE Retired Moderator

- Posts: 4823
- Joined: Fri Jun 18, 2004 1:40 pm
- Location: Berlin, Germany
- x 8
I know there were some posts on this topic and one quite complete with all options, but I can't find it.
Having your executable in one directory and all other DLLs in another directory difficult to archieve, because of the way DLLs are loaded. There are basically two ways: you use an import lib for the DLL (like Ogremain.lib is for OgreMain.dll) or you load your library dynamically via LoadLibrary()(or similiar don't know the true API call). This is done with the plugins.
For the first option the DLL must be found by the system. It searches for it in some places, namely the current working directory and your system32 directory. So if you don't want to have your DLLs littering your directory you could place them into system32. But this absolutely cries for problems.
Another way is to have an executable, that does some initialization work, whatever your application has to do then changes the working directory to where the DLLs can be found and then dynamically loads your game dll, that is linked against OgreMain.lib et al. I've never done this, so there might be trouble I don't know of.
Or just start your application with a batch file that changes work directory to the directory with your executable and DLLs.
Having your executable in one directory and all other DLLs in another directory difficult to archieve, because of the way DLLs are loaded. There are basically two ways: you use an import lib for the DLL (like Ogremain.lib is for OgreMain.dll) or you load your library dynamically via LoadLibrary()(or similiar don't know the true API call). This is done with the plugins.
For the first option the DLL must be found by the system. It searches for it in some places, namely the current working directory and your system32 directory. So if you don't want to have your DLLs littering your directory you could place them into system32. But this absolutely cries for problems.
Another way is to have an executable, that does some initialization work, whatever your application has to do then changes the working directory to where the DLLs can be found and then dynamically loads your game dll, that is linked against OgreMain.lib et al. I've never done this, so there might be trouble I don't know of.
Or just start your application with a batch file that changes work directory to the directory with your executable and DLLs.
-
iq
- Greenskin
- Posts: 125
- Joined: Mon Oct 20, 2003 8:25 pm
-
Emmeran
- Goblin
- Posts: 272
- Joined: Wed Jun 02, 2004 11:47 am
- Location: Erlangen
-
alphabeta
- Kobold
- Posts: 34
- Joined: Mon Jan 03, 2005 5:07 am
http://www.codeguru.com/Cpp/W-P/dll/article.php/c99
This shows a way to use application specific dll paths in windows, but take a step back and make sure you really want to do this first. It's not portable, and you have to go through the registry. A better idea would be keeping the exe with the dll's, and using a shortcut (or batch file) to the exe in the root folder of your app.
This shows a way to use application specific dll paths in windows, but take a step back and make sure you really want to do this first. It's not portable, and you have to go through the registry. A better idea would be keeping the exe with the dll's, and using a shortcut (or batch file) to the exe in the root folder of your app.
-
:wumpus:
- OGRE Retired Team Member

- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
-
Emmeran
- Goblin
- Posts: 272
- Joined: Wed Jun 02, 2004 11:47 am
- Location: Erlangen