Shared library

There are some differences between shared libraries on linux (*.so), windows (*.dll) and MacOS (*.dylib).

The shared libraries must be located in some folder where they can be found, either by the linker, or by the OS runtime.

It is possible to add the folders of the libraries to the system Path, or copy those shared libraries to some system folder, so they are found by the OS.

In Windows and OSX, the simplest approach is just to copy the shared libraries to the executable folder, so they are found by the executable, without having to modify the path.

In UNIX based operating systems like Linux and OSx, there is something called rpath (run-time search path) that is used to locate the shared libraries that another library or executable needs for execution.

The rpath is encoded inside dynamic libraries and executables and helps the linker to find its required shared libraries.

In linux rpath is just an option, which means that, if the linker doesn’t find the library in rpath, it will continue the search in system defaults paths (LD_LIBRARY_PATH... etc)

But in OSX with dylibs it doesn’t work like that. In OSX, if the linker detects that an rpath is invalid (the file does not exist there), it will fail. In OSX, libraries are built with the hard restriction of knowing (before installing them) where (in which folder) they will be installed.

时间: 2024-08-29 06:54:19

Shared library的相关文章

【已解决】运行Eclipse出错:Failed toload the JNI shared library

[问题] 运行Android的ADT,即Eclipse出错: Failed to load the JNIshared library C:\Program Files(x86)\Java\jre6\bin\client\jvm.dll 其中背景是: 1.之前已经可以正常运行的,即已经正常安装了JRE6的. 2.后来删除掉了JRE6了. 3.刚刚又去重新安装了JRE6,结果还是错误依旧. 4.并且已经确定了:C:\ProgramFiles (x86)\Java\jre6\bin\client\j

启动 Eclipse 弹出“Failed to load the JNI shared library jvm.dll”错误的解决方法!

启动 Eclipse 弹出"Failed to load the JNI shared library jvm.dll"错误的解决方法 http://blog.csdn.net/zyz511919766/article/details/7442633   原因1:给定目录下jvm.dll不存在. 对策:(1)重新安装jre或者jdk并配置好环境变量.(2)copy一个jvm.dll放在该目录下. 原因2:eclipse的版本与jre或者jdk版本不一致 对策:要么两者都安装64位的,要

dynamic-link library shared library of functions and resources

https://msdn.microsoft.com/en-us/library/1ez7dh12.aspx A dynamic-link library (DLL) is an executable file that acts as a shared library of functions and resources. Dynamic linking enables an executable to call functions or use resources stored in a s

Qt学习之路(60): 创建shared library

前段时间说了Qt一些类库的使用,今天来换一下口味,来看一下程序设计的问题.今天来说的是关于共享库 shared library. 如果你打开一些 Windows 应用程序的目录,你会发现有很多程序的 exe 文件都很小,大约几百K 的样子,并且目录中不仅仅只有一个 exe 文件,还包含着一大堆 dll 文件.这些 dll 其实就是一些共享库,所谓共享库,其实就是一些动态链接库,能够由程序在运行时进行动态加载的库.既然说是共享,那就是说,这些库不仅仅自己的程序可以使用,并且其他程序也可以使用,例如

eclipse-failed to load the JNI shared library

很久没有用eclipse,刚才打开,提示:failed to load the jni shared library.这个问题一般是eclipse和JDK位数不一样. 解决方案: 1,在cmd中输入[java -version] 在这里,画线部分是Client VM表示是32位的jdk.若是64-bit Server,表示64位jdk. 2,打开eclipse安装目录 记事本方式打开eclipse.ini.我用sublime打开的.如下图.划红线处,是win32.x86表示32位.win32.x

启动Eclipse 弹出“Failed to load the JNI shared library”错误的解决方法

原因1:eclipse的版本与jre或者jdk版本不一致 对策:要么两者都安装64位的,要么都安两个是32位一个是64位. 原因2:给定目录下jvm.dll不存在 对策:(1)重新安装jre或者jdk并配置好环境变量.(2)copy一个jvm.dll放在该目录下. 原因1的概率更大一些,原因2不太可能发生. 启动Eclipse 弹出"Failed to load the JNI shared library"错误的解决方法,布布扣,bubuko.com

Eclipse运行时提示“Failed to load the JNI shared library /Java/jre6/bin/client/jvm.dll”的一个解决方案

出现这个问题的一个原因是eclipse需要的32位jdk,你的环境变量中配的是64位jdk 于是有人建议,重装个32位的jdk,把环境变量换成32位的jdk,但如果你的其它程序需要64位jdk的话,这肯定不是一个好办法 还有一种方法是在 eclipse根目录下有个eclipse.ini文件,添加个 -vm参数 -vm C:/Java32/jdk1.7.0_45/bin/javaw.exe      //这是我的32位jdk 注意位置 -startup plugins/org.eclipse.eq

Eclipse启动 报错[Failed to load the JNI shared library jvm.dll

准备要做java服务器,在安装开发环境时,启动Eclipse报错[Failed to load the JNI shared library jvm.dll] 研究了下,造成错误的原因是由于eclipse与jdk的不一致造成的. 我的开发环境是64位windows8 Pro,安装了64位jdk1.6,eclipse却粗物的安装了32位的版本,由于64位和32位匹配不一致,造成了以上错误的发生. 又尝试了一下,32位jdk+64位eclipse也会发生同样的问题. 好了,解决方法很简单,jdk和e

Eclipse错误提示:The Eclipse executable launcher was unable to locate its companion shared library.

打开Eclipse弹出错误提示:TheEclipse executable launcher was unable to locate its companion shared library. 中文意思:Eclipse可执行文件的启动器无法找到它的共享库(google告诉我的,目前的英文水平还不咱滴,正努力中) Eclipse.ini文件内容如下: -startup plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.j

启动eclipse时出现“Failed to load the JNI shared library jvm.dll”错误及解决

昨晚安装另一个版本的eclipse,启动时出现了"Failed to load the JNI shared library jvm.dll"错误: 1.刚开始以为是因为当时没有将旧版本删除干净,于是就找了原来的安装目录,并没有发现残留的配置文件以及启动文件什么的: 2.于是猜测,新安装的这个版本目录下没有jvm.dll这个文件,可是发现是存在的: 路径1:C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll(该路径下安装的是32位的J