Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all!
This is santosh. I wante to devide a big MFC project into a couple of smaller DLL projects. I was successful in this but now I want to have a seaparate folder called dll in my application where all the all the DLLs from the subprojects are placed.

Can anybody give me guidance in how to achieve this.

For more information please review my original question: Dll implementation :sigh: :sigh:

Thanks in advance!
Posted
Updated 27-Feb-11 20:02pm
v2
Comments
Manfred Rudolf Bihy 28-Feb-11 2:03am    
Edited for grammar, speeling, clarity and conciser title.
[no name] 28-Feb-11 3:10am    
thanks for editing my question and give such good meaning

You may use one of these options:

1- for each project, change the target dll.
In the project properties, select the Linker options, then General, and change the "Output File" box. Be careful to change this for all configurations (not only Release or Debug).
Just be aware that changing this might change the .lib destination folder as well, so you might have to change the linking options for the projects which need to import the .lib files.
For your information, the destination .lib can be found under Linker, Advanced, "Import Library"

2- for each project, add a Post-Build Event to copy the required files to the destination folder you want.
In the project properties, select the Build Events options, then Post-Build Event, and edit the "Command Line" box. Add something like
copy "$(TargetPath)" "yourDestinationFolder"

You may optionnaly add a description. This description will be displayed in the output window during the compilation.
Be careful to change this for all configurations (not only Release or Debug).
With this solution, .dll and .lib files are not changed.
 
Share this answer
 
Comments
[no name] 1-Mar-11 6:26am    
Thanks for still connecting

actually i doesn't want output dll in saparate folder i want to run my mfc application that link with dll and all dlls keeps in saparate folder called \DLL\
Olivier Levrey 1-Mar-11 7:30am    
Oh OK! Then see my new answer.
If you link your exe to the dlls statically (with .lib files), then the only possibility to make windows search your dlls in the directory you want is to modify the PATH environment variable and add your directory there.

If you load dynamically the dlls, then you can tell windows to search in other folders with the SetDllDirectory function. See this for more information:
http://msdn.microsoft.com/en-us/library/ms686203(v=vs.85).aspx[^]

And also have a look to this link to understand how dlls are searched and loaded when your application starts or when you are loading them dynamically:
http://msdn.microsoft.com/en-us/library/ms682586(v=vs.85).aspx[^]
 
Share this answer
 
Comments
[no name] 1-Mar-11 22:54pm    
Its useful but changing path variable making dificult to me
Olivier Levrey 2-Mar-11 3:45am    
Yes I was just writting down the possible options. Changing the PATH variable shouldn't be done in most cases, so just forget it ;)
I saw from the other post that you found at last what you were looking for: delay dll loading with LoadLibrary and GetProcAdress functions. Good then.
[no name] 2-Mar-11 5:43am    
I really want deal with path variable but no situation occured untill now.

thanks for your guidance on implementation

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900