国产亚洲精品AA片在线观看,丰满熟妇HD,亚洲成色www成人网站妖精,丁香五月天婷婷五月天男人天堂

新聞中心

EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 控制linux動(dòng)態(tài)鏈接庫(kù)導(dǎo)出函數(shù)

控制linux動(dòng)態(tài)鏈接庫(kù)導(dǎo)出函數(shù)

作者: 時(shí)間:2016-11-22 來(lái)源:網(wǎng)絡(luò) 收藏
linux中,我們可以通過(guò)-fvisibility=default|internal|hidden|protected來(lái)控制導(dǎo)出函數(shù)。

在GCC幫助文檔 -fvisibility=default|internal|hidden|protected參數(shù)下有這樣一段描述:

本文引用地址:http://www.ljygm.com/article/201611/320008.htm

a superior solution made possible by this option to marking things hidden when the default is public is to make the default hidden and mark things public. This is the norm with DLLs on Windows and with -fvisibility=hidden and "__attribute__ ((visibility("default")))" instead of "__declspec(dllexport)" you get almost identical semantics with identical syntax. This is a great boon to those working with cross-platform projects.

需要了解的是,在linux下,源文件中的所有函數(shù)都有一個(gè)默認(rèn)的visibility屬性,即為public,在編譯命令中加入 -fvisibility=hidden參數(shù),會(huì)將所有默認(rèn)的public的屬性變?yōu)閔idden。此時(shí),如果對(duì)函數(shù)設(shè)置__attribute__ ((visibility("default")))參數(shù),使特定的函數(shù)仍然按默認(rèn)的public屬性處理,則-fvisibility=hidden參數(shù)不會(huì)對(duì)該函數(shù)起作用。所以,設(shè)置了-fvisibility=hidden參數(shù)之后,只有設(shè)置了__attribute__ ((visibility("default")))的函數(shù)才是對(duì)外可見(jiàn)的。



評(píng)論


技術(shù)專區(qū)

關(guān)閉