久久久久久久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)嗎?)
主站蜘蛛池模板: 免费簧片视频 | 国产一区二区三区四区五区加勒比 | 色橹橹欧美在线观看视频高清 | 一级做a爰片性色毛片16美国 | 亚洲欧美中文日韩在线v日本 | avhd101在线成人播放 | 欧美一区二区在线观看 | 国产午夜三级一区二区三 | av在线免费网站 | 亚洲不卡在线观看 | 久久久久国产精品一区 | 欧美日韩综合一区 | 成人免费在线视频 | 91麻豆产精品久久久久久夏晴子 | 在线视频国产一区 | 夜夜草导航 | 欧美高清视频在线观看 | 国产一级特黄视频 | 最近日韩中文字幕 | 精品一区二区三区在线观看国产 | 一道本在线 | 欧美日韩国产不卡 | 日韩精品一区二区三区视频播放 | 毛片一区二区三区 | 精品九九| 国产一级片免费视频 | 免费人成激情视频在线观看冫 | 蜜月aⅴ免费一区二区三区 99re在线视频 | 亚洲精品一区中文字幕乱码 | 国产精品五月天 | 成人精品视频 | 天天操天天摸天天干 | 丝袜天堂| 中文字幕在线观看一区 | 国产在线二区 | 日韩精品区 | 日韩久久久久久 | 亚洲视频在线播放 | 日韩免费一区 | h视频在线观看免费 | 亚洲免费视频在线观看 |