来自子项目的输出DLL的单独文件夹 [英] Separate folder for output DLLs from subprojects

查看:89
本文介绍了来自子项目的输出DLL的单独文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!
这是桑托什.我想将一个大型MFC项目划分为几个较小的DLL项目.我在此方面很成功,但是现在我想在我的应用程序中有一个名为dll的seaparate文件夹,其中放置了子项目中的所有DLL.

有人可以指导我如何实现这一目标吗?

有关更多信息,请查看我的原始问题: Dll实现 :sigh::sigh:

在此先谢谢您!

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!

推荐答案

您可以使用以下选项之一:

1-对于每个项目,更改目标dll.
在项目属性中,选择链接器"选项,然后选择常规",然后更改输出文件"框.请针对所有配置(不仅是Release或Debug)更改此设置.
请注意,更改此设置也可能会更改.lib目标文件夹,因此您可能必须更改需要导入.lib文件的项目的链接选项.
对于您的信息,可以在链接器",高级",导入库"下找到目标.lib.

2-对于每个项目,添加一个构建后事件,以将所需文件复制到所需的目标文件夹中.
在项目属性中,选择生成事件"选项,然后选择生成后事件",然后编辑命令行"框.添加类似的内容
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"
(TargetPath)" "yourDestinationFolder"


您可以选择添加说明.该描述将在编译期间显示在输出窗口中.
请针对所有配置(不仅是Release或Debug)更改此设置.
使用此解决方案,.dll和.lib文件不会更改.


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.


如果您将exe静态链接到dll(带有.lib文件),则使Windows搜索您的文件的唯一可能性您想要的目录中的dll是修改PATH环境变量并在其中添加目录.

如果动态加载dll,则可以使用SetDllDirectory函数告诉Windows在其他文件夹中搜索.请参阅此以获取更多信息:
http://msdn.microsoft.com/en-us/library/ms686203 (v = vs.85).aspx [ http://msdn.microsoft.com/en-us/library/ms682586 (v = vs.85).aspx [
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[^]


这篇关于来自子项目的输出DLL的单独文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆