• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            天下

            記錄修行的印記

            Double Thunking


            By default, when compiling with /clr (not /clr:pure), the definition of a managed function causes the compiler to generate a managed entry point and a native 

            entry point. This allows the managed function to be called from native and managed call sites. However, when a native entry point exists, it can be the entry 
            point for all calls to the function. If a calling function is managed, the native entry point will then call the managed entry point. In effect, two calls 
            are required to invoke the function (hence, double thunking). For example, virtual functions are always called through a native entry point.
            One resolution is to tell the compiler not to generate a native entry point for a managed function, that the function will only be called from a managed 
            context, by using the __clrcall calling convention.
            Similarly, if you export (dllexport, dllimport) a managed function, a native entry point is generated and any function that imports and calls that function 
            will call through the native entry point. To avoid double thunking in this situation, do not use native export/import semantics; simply reference the 
            metadata via #using (see The #using Directive).
            In Visual C++ 2005 the compiler was updated to reduce unnecessary double thunking. For example, any function with a managed type in the signature (including 
            return type) will implicitly be marked as __clrcall. For more information on double thunk elimination, see 
            http://msdn.microsoft.com/msdnmag/issues/05/01/COptimizations/default.aspx.
            Example
            The following sample demonstrates double thunking. When compiled native (without /clr), the call to the virtual function in main generates one call to T's 
            copy constructor and one call to the destructor. Similar behavior is achieved when the virtual function is declared with /clr and __clrcall. However, when 
            just compiled with /clr, the function call generates a call to the copy constructor but there is another call to the copy constructor due to the 
            native-to-managed thunk.
            純 MSIL 程序集可以調(diào)用非托管函數(shù),但不能由非托管函數(shù)調(diào)用。因此,與非托管函數(shù)使用的服務(wù)器代碼相比,純 MSIL 更適合于使用非托管函數(shù)的客戶端代碼。
            當(dāng)我們使用/clr選項(不是/clr:pure)進行編譯的時候,一個托管函數(shù)(managed function),會導(dǎo)致編譯器生成一個托管的入口點(managed entry point)和一個原生的入口點
            (native entry point),這樣可以使得托管函數(shù)既可以被托管代碼調(diào)用,也可以被原生代碼調(diào)用。但是,當(dāng)一個原生的入口點存在的時候,它將成為所有調(diào)用的入口點。也就是說
            如果調(diào)用者是托管的,它還是會先去調(diào)用原生入口點,然后原生的入口點再去調(diào)用托管的入口點,這就意味著調(diào)用了兩次函數(shù)入口點(Double Thunking)。 



            c++ cli 標(biāo)準(zhǔn)

            posted on 2015-12-01 11:14 天下 閱讀(323) 評論(0)  編輯 收藏 引用 所屬分類: C#

            <2019年2月>
            272829303112
            3456789
            10111213141516
            17181920212223
            242526272812
            3456789

            導(dǎo)航

            統(tǒng)計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            国产精品久久免费| 久久综合亚洲色HEZYO社区| 国产精品美女久久久久久2018| 久久久久久亚洲精品成人| 久久综合香蕉国产蜜臀AV| 99国产精品久久久久久久成人热| 国产精品99久久久久久www| 久久久精品久久久久影院| 久久亚洲AV成人无码电影| 丁香五月综合久久激情| 无码超乳爆乳中文字幕久久| 久久精品欧美日韩精品| 亚洲国产天堂久久综合| 九九99精品久久久久久| AV无码久久久久不卡蜜桃| 一本色道久久88加勒比—综合| 久久久久99这里有精品10| 国产高潮久久免费观看| 欧美黑人又粗又大久久久| 一本久道久久综合狠狠躁AV| 伊人久久免费视频| 久久综合噜噜激激的五月天| 久久久久亚洲av成人网人人软件 | 亚洲成av人片不卡无码久久| 久久久久久国产精品免费无码 | 欧美亚洲国产精品久久久久| 一本大道加勒比久久综合| 无码人妻久久久一区二区三区| 一本色道久久88综合日韩精品| 丁香五月综合久久激情| 99久久无码一区人妻a黑| 亚洲av伊人久久综合密臀性色| 欧美伊人久久大香线蕉综合69| 91精品国产高清久久久久久91 | 久久免费香蕉视频| 蜜桃麻豆www久久| 99久久精品毛片免费播放| 亚洲欧美日韩久久精品第一区| 久久久久se色偷偷亚洲精品av| 亚洲午夜福利精品久久| 久久综合五月丁香久久激情|