久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

靜態(tài)庫(kù)和共享庫(kù)的區(qū)別?

Difference between static and shared libraries?(靜態(tài)庫(kù)和共享庫(kù)的區(qū)別?)
本文介紹了靜態(tài)庫(kù)和共享庫(kù)的區(qū)別?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

靜態(tài)庫(kù)和共享庫(kù)有什么區(qū)別?

What is the difference between static and shared libraries?

我使用 Eclipse 并且有幾種項(xiàng)目類型,包括靜態(tài)庫(kù)和共享庫(kù)?一個(gè)比另一個(gè)有優(yōu)勢(shì)嗎?

I use Eclipse and there are several project types including Static Libraries and Shared Libraries? Does one have an advantage over the other?

推薦答案

共享庫(kù)是 .so(或在 Windows .dll 中,或在 OS X .dylib 中)文件.與庫(kù)相關(guān)的所有代碼都在這個(gè)文件中,并且在運(yùn)行時(shí)被使用它的程序引用.使用共享庫(kù)的程序只引用它在共享庫(kù)中使用的代碼.

Shared libraries are .so (or in Windows .dll, or in OS X .dylib) files. All the code relating to the library is in this file, and it is referenced by programs using it at run-time. A program using a shared library only makes reference to the code that it uses in the shared library.

靜態(tài)庫(kù)是 .a(或在 Windows 中的 .lib)文件.與庫(kù)相關(guān)的所有代碼都在這個(gè)文件中,并且在編譯時(shí)直接鏈接到程序中.使用靜態(tài)庫(kù)的程序從靜態(tài)庫(kù)中復(fù)制它使用的代碼,并使其成為程序的一部分.[Windows 也有用于引用 .dll 文件的 .lib 文件,但它們的作用與第一個(gè)相同].

Static libraries are .a (or in Windows .lib) files. All the code relating to the library is in this file, and it is directly linked into the program at compile time. A program using a static library takes copies of the code that it uses from the static library and makes it part of the program. [Windows also has .lib files which are used to reference .dll files, but they act the same way as the first one].

每種方法都有優(yōu)點(diǎn)和缺點(diǎn):

There are advantages and disadvantages in each method:

  • 共享庫(kù)減少了使用該庫(kù)的每個(gè)程序中重復(fù)的代碼量,從而使二進(jìn)制文件保持較小.它還允許您用功能等效的共享對(duì)象替換共享對(duì)象,但可能會(huì)增加性能優(yōu)勢(shì),而無(wú)需重新編譯使用它的程序.但是,共享庫(kù)會(huì)產(chǎn)生少量額外的函數(shù)執(zhí)行成本以及運(yùn)行時(shí)加載成本,因?yàn)閹?kù)中的所有符號(hào)都需要連接到它們使用的東西.此外,共享庫(kù)可以在運(yùn)行時(shí)加載到應(yīng)用程序中,這是實(shí)現(xiàn)二進(jìn)制插件系統(tǒng)的通用機(jī)制.

  • Shared libraries reduce the amount of code that is duplicated in each program that makes use of the library, keeping the binaries small. It also allows you to replace the shared object with one that is functionally equivalent, but may have added performance benefits without needing to recompile the program that makes use of it. Shared libraries will, however have a small additional cost for the execution of the functions as well as a run-time loading cost as all the symbols in the library need to be connected to the things they use. Additionally, shared libraries can be loaded into an application at run-time, which is the general mechanism for implementing binary plug-in systems.

靜態(tài)庫(kù)會(huì)增加二進(jìn)制文件的整體大小,但這意味著您無(wú)需攜帶正在使用的庫(kù)的副本.由于代碼是在編譯時(shí)連接的,因此沒(méi)有任何額外的運(yùn)行時(shí)加載成本.代碼就在那里.

Static libraries increase the overall size of the binary, but it means that you don't need to carry along a copy of the library that is being used. As the code is connected at compile time there are not any additional run-time loading costs. The code is simply there.

就個(gè)人而言,我更喜歡共享庫(kù),但在需要確保二進(jìn)制文件沒(méi)有很多可能難以滿足的外部依賴項(xiàng)時(shí)使用靜態(tài)庫(kù),例如特定版本的 C++ 標(biāo)準(zhǔn)庫(kù)或特定版本的 Boost C++圖書(shū)館.

Personally, I prefer shared libraries, but use static libraries when needing to ensure that the binary does not have many external dependencies that may be difficult to meet, such as specific versions of the C++ standard library or specific versions of the Boost C++ library.

這篇關(guān)于靜態(tài)庫(kù)和共享庫(kù)的區(qū)別?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Algorithm to convert RGB to HSV and HSV to RGB in range 0-255 for both(將 RGB 轉(zhuǎn)換為 HSV 并將 HSV 轉(zhuǎn)換為 RGB 的算法,范圍為 0-255)
How to convert an enum type variable to a string?(如何將枚舉類型變量轉(zhuǎn)換為字符串?)
When to use inline function and when not to use it?(什么時(shí)候使用內(nèi)聯(lián)函數(shù),什么時(shí)候不使用?)
Examples of good gotos in C or C++(C 或 C++ 中好的 goto 示例)
Significance of ios_base::sync_with_stdio(false); cin.tie(NULL);(ios_base::sync_with_stdio(false) 的意義;cin.tie(NULL);)
Is TCHAR still relevant?(TCHAR 仍然相關(guān)嗎?)
主站蜘蛛池模板: 国产伦精品一区二区三区照片91 | 欧美激情黄色 | 久久男人 | 久久久久久国 | 男女污污动态图 | 精品二区 | 免费看一区二区三区 | 一级免费毛片 | 亚洲精品视频在线看 | 久久久久久国产精品mv | 久久精品一区二 | 国产精品99视频 | 在线观看成人精品 | 日韩中文在线视频 | 国产精品久久久久久久久免费相片 | 国产九九九| 九九免费视频 | 夜夜爽99久久国产综合精品女不卡 | 成人午夜在线 | 国产精品毛片无码 | 天天操夜夜操 | 亚洲理论在线观看电影 | 国产精品视频免费观看 | 国产区精品在线观看 | 欧美激情欧美激情在线五月 | 亚洲精品久久久蜜桃 | 久久99国产精品 | 国产婷婷色一区二区三区 | 国产精品久久久久一区二区三区 | 亚洲色图综合 | av三级在线观看 | 请别相信他免费喜剧电影在线观看 | 国产欧美日韩在线观看 | 黄色成人国产 | 视频一区二区在线观看 | 九九热国产视频 | 国产三区av | 成人毛片网 | 成人三级av | 欧美日本久久 | 免费成人高清在线视频 |