The Distinguish of the share or static lib in MFC
2013-01-18 09:34
405 查看
如果选择use MFC in a Shared DLL 的话,你编译后的程序中不包含MFC库,所以文件会比较小,但是如果你的程序直接移到一个没有安装过MFC的机器上时,可能会导致找不到MFC的DLL。
如果选择Use MFC in a Static Library ,那你编译后的程序就直接包含了调用MFC的部分的库,文件可能会大一些,但是可以直接移到其他机器上运行。
前者是动态连接,发布要带MFC得DLL文件。
后者是静态链接,发布不用带MFC的DLL文件。
如果可执行文件只有一个,使用前者,执行速度快,但文件比较大。
如果可执行文件多个,使用后者,因为DLL文件是共享的,所以文件体积总量减少。
单个文件也小。加载执行块,但运行速度略比前者慢。
used in a static library:
使用lib文件。lib是已经编译好的二进制文件,可以与你的工程静态链接起来成为一个exe。
used in a shared dll:
使用dll文件,函数实现隐藏在DLL文件内部,你的工程编译成exe文件后,运行时才调用dll 。
------------------------------------------------------------------------------
A static library means the code you use from the library is included in your executable. Because of this, you don't need to ship the library or require the end user to have it on their machine. However this bloats the size of your executable and ties you to that library version, so if you need to update just the library, you have to ship a new executable.
A shared library calls the library at the time it needs it (runtime) to execute the code, but it requires the user to have it (usually a specific or minimum version) installed on their machine. You can also distribute the required version of the library with your application if you need to.
As for which is better, I don't know. I'm not a Windows C++ or MFC programmer so I couldn't say. On my Linux servers, the applications I write are generally server-side and thus use shared libraries.
It depends on how your application is to be used, distributed, updated, how often the MFC library changes, if it's generally available on user's PCs etc.
如果选择Use MFC in a Static Library ,那你编译后的程序就直接包含了调用MFC的部分的库,文件可能会大一些,但是可以直接移到其他机器上运行。
前者是动态连接,发布要带MFC得DLL文件。
后者是静态链接,发布不用带MFC的DLL文件。
如果可执行文件只有一个,使用前者,执行速度快,但文件比较大。
如果可执行文件多个,使用后者,因为DLL文件是共享的,所以文件体积总量减少。
单个文件也小。加载执行块,但运行速度略比前者慢。
used in a static library:
使用lib文件。lib是已经编译好的二进制文件,可以与你的工程静态链接起来成为一个exe。
used in a shared dll:
使用dll文件,函数实现隐藏在DLL文件内部,你的工程编译成exe文件后,运行时才调用dll 。
------------------------------------------------------------------------------
A static library means the code you use from the library is included in your executable. Because of this, you don't need to ship the library or require the end user to have it on their machine. However this bloats the size of your executable and ties you to that library version, so if you need to update just the library, you have to ship a new executable.
A shared library calls the library at the time it needs it (runtime) to execute the code, but it requires the user to have it (usually a specific or minimum version) installed on their machine. You can also distribute the required version of the library with your application if you need to.
As for which is better, I don't know. I'm not a Windows C++ or MFC programmer so I couldn't say. On my Linux servers, the applications I write are generally server-side and thus use shared libraries.
It depends on how your application is to be used, distributed, updated, how often the MFC library changes, if it's generally available on user's PCs etc.
相关文章推荐
- Use MFC in a Static Library,This may be due to a corruption of the heap....
- Static or dynamic lib in vs
- The name or security ID (SID) of the domain specified is inconsistent with the trust information for that domain.
- Making the Newsfeed web part available outside of My Sites in SharePoint 2013
- Class JavaLaunchHelper is implemented in both … libinstrument.dylib. One of the two will be used. Wh
- java.lang.NoSuchFieldError: No static field xxx of type I in class Lcom/XX/R$id; or its superclasses
- Enable Android progurad in the case of multiple JAR lib
- The server has either erred or is incapable of performing the requested operation. (HTTP 500)
- Some of the Best Open Source Project's in VC++ & MFC
- How to hide my site and my document link in the right-top corner of sharepoint 2010
- Django URLs error: view must be a callable or a list/tuple in the case of include()
- One of the disks in this virtual machine is already in use by a virtual machine or by a snapshot"
- This generally means that another instance of this process was already running or is hung in the deb
- We are unable to complete the review of your app since one or more of your In App Purchases have not
- The study of chapter 13 in programming windows with mfc-printing with document and views
- Some of the best Open Source Project's in VC++ & MFC
- Some of the best Open Source Project's in VC++ & MFC
- The difference of static, readonly and const in C#
- UBUNTU 9.10 因断电升级未成功后重启出现“one or more of the mounts listes in /etc/fstab cannot yet be mounted?”?
- SharePoint Designer Check In and Check Out Error – Cannot perform this operation.The file is no longer check out or has been del