zoukankan      html  css  js  c++  java
  • Shared Library Search Paths

    在使用CodeLite编译动态库的时候,可以通过在Linker > Linker Options中添加:

      -install_name @executable_path/libXXX.so

    的方式更改动态库的Install Name。

    在控制台中输入man ld之后, 会显示ld的帮助信息。其中包含-install_name参数的详细描述:

    -install_name name

                     Sets an internal "install path" (LC_ID_DYLIB) in a dynamic library. Any clients linked against the library will

                     record that path as the way dyld should locate this library.  If this option is not specified, then the -o path

                     will be used.  This option is also called -dylib_install_name for compatibility.

    在类Unix系统下,动态库的名字应该以“lib”开头。在应用程序链接阶段,如果想链接一个动态库,需以去掉“lib”和扩展名后的库名来进行链接。比如,如果要链接一个名为libXXX.so的动态库,需要通过设置-lXXX来进行链接。

    参考

    https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/RunpathDependentLibraries.html

    http://www.eyrie.org/~eagle/notes/rpath.html

    http://thecourtsofchaos.com/2013/09/16/how-to-copy-and-relink-binaries-on-osx/

    http://osiris.laya.com/coding/dylib_linking.html

    https://www.mikeash.com/pyblog/friday-qa-2009-11-06-linking-and-install-names.html

  • 相关阅读:
    linux之dup和dup2函数解析
    UNIX标准及实现
    UNIX基础知识
    HTML5学习笔记----html5与传统html区别
    c#设计模式-简单工厂
    c#设计模式-工厂模式
    MVC模式与三层架构的区别
    C# params传递多个参数
    SFC20 功能例子 注解
    工业以太网:十个核心基础概念
  • 原文地址:https://www.cnblogs.com/lilei9110/p/4154974.html
Copyright © 2011-2022 走看看