• 微软的Dll管理方案及其变迁(Side-by-side assembly)


    本文简要介绍Side-by-side assembly技术,探讨在插件技术中使用类似方法的可能。

    什么是Side-ty-side Assembly

    Side-by-side assemblyWindows Xp及以上系统解决动态链接库版本冲突所使用的技术,要点是编译程序时,由Visual Studio生成一个manifest文件,指明本应程序所使用的动态链接库的版本;发布程序时也要发布该manifest文件,供客户计算机上的dll loader根据manifest加载适当版本的dll,如果不发布该项manifest,客户机按默认版本加载Dll

    Representation of typical side-by-side assembly

    Representation of typical side-by-side assembly

    http://msdn.microsoft.com/en-us/library/aa376307.aspx

    引自MSND网站

    如下所示是一个用VS2008编译应用程序后生成的manifest文件,重点是指明了Microsoft.VC90.CRT的版本号,即本程序所用CC++的动态链接库的版本号。

    <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
    <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
          <requestedPrivileges>
            <requestedExecutionLevel level='asInvoker' uiAccess='false' />
          </requestedPrivileges>
        </security>
      </trustInfo>
      <dependency>
        <dependentAssembly>
          <assemblyIdentity type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
        </dependentAssembly>
      </dependency>
    </assembly>

    对软件发布的影响

    发布这个应用程序时,要确保相同版本的动态库安装到客户的计算机上,所以要用微软提供的相应的redistributable packege,注意VSVS SP的动态库是不一样的,但VS会默认用VS提供的版本。与此相关的问题是编译器有权为应用程序指定所需的动态链接库的版本,而CC++的运行时库与VC的版本时相关的,关于如何设置可参考 http://msdn.microsoft.com/en-us/library/cc664727%28v=VS.90%29.aspx

    另一方面,应用程序除用到微软的dll之外,还会用到第三方库,这时确保所有库都能访问到正确版本的运行时库就变得非常重要了。


    在插件技术中应用类似方法

    VS2010中,微软已放弃这种方法,而是在DLL文件后加了一个版本号,同名的DLL只要版本号不同,以后也视为两个DLL。独立于操作系统插件系统,其中一定会有一个模块起到Dll Loader的作用,能够允许不同版本的同名插件同时存在在系统中有助于软件系统的升级,有助于及时快速地满足用户的需要。参见 http://en.wikipedia.org/wiki/Side-by-side_assembly 

  • 相关阅读:
    流程控制语句
    java运算符
    变量
    java虚拟机
    常量
    java注释
    java标识符
    单击显示随机文字
    2018/6/25~2018/6/29 周记
    2018/6/19~2018/6/22 周记
  • 原文地址:https://www.cnblogs.com/lidabo/p/3482502.html
Copyright © 2020-2023  润新知