dynamic-linking

linux dlopen can not find static library's symbol

百般思念 提交于 2019-12-11 21:17:37
问题 I have an executable project which uses a shared library, that includes a static library. Then from the executable, I try to load another shared library with dlopen . That library is found but it cannot find symbols from static library. Here is the structure: -- SHARED LIB 1 -- (compiled with) Static Lib 1 -- EXECUTABLE -- SHARED LIB 1 -- dlopen SHARED LIB 2 XX ERROR: SHARED LIB 2 cannot find symbols of Static Lib 1 Both SHARED LIB 1 and SHARED LIB 2 are linked from /usr/lib . It seems that I

How do I link a simple example project to libusb?

你离开我真会死。 提交于 2019-12-11 19:01:32
问题 I'm trying to make use of LibUSB to interact with a small programmable LED device I've built. I have working code on Windows using the libusb-win32 port but I'm having trouble porting this to the MAC. I've cloned LibUSB to a local git repository and compiled it using XCode I think is the preferred method on the MAC. After a bit of digging (including showing the hidden Library folder), it looks like XCode outputs to /Users/jon/Library/Developer/Xcode/DerivedData/libusb

Program linked against libraries that share symbol names runs wrong implementation

点点圈 提交于 2019-12-11 10:56:25
问题 This a bit difficult to understand but I'm doing my best. On Red Hat 6.4 with gcc 4.4.6 & ld 2.20.51, I am linking into a binary executable PROGRAM code from one shared library (.so) and a static library (.a) . The shared library exposes an API invoked directly by PROGRAM. The implementation of this shared library is compiled & linked against a static library static lib1 . The static library also exposes its own API which is invoked directly by PROGRAM. And some of its implementation is based

Address range of a dynamically loaded library under Linux

蓝咒 提交于 2019-12-11 09:51:31
问题 I have a working program that loads plugins with dlopen . New requirement: at some point in the code, I'm given a pointer, and I need to test whether this pointer points into the code or static data of a plugin. bool is_pointer_into_plugin(void *p, void *handle); Equivalently, I need to retrieve the plugin into which a pointer points, if any. I also need to know if the pointer points into the main program's code or static data (and ideally, distinguish between read-only and read-write areas).

What is inside SO file of Python library distribution?

做~自己de王妃 提交于 2019-12-11 09:15:52
问题 I got a library, which consists of 3 files FbxCommon.py fbxsip.so fbx.so which are intended to be put in site python directory. Once these files are in place, Python can see fbx package. How it this system works? What is inside SO file? If it is DLL how can it be python version-dependent (it works with python 3.3 but doesn't work with python 3.5) UPDATE Distinguishing code is following from fbx import * lSdkManager = FbxManager.Create() on Python 3.3. it just does nothing, while on Python 3.5

How the dynamic linker determines which routine to call on Linux?

你说的曾经没有我的故事 提交于 2019-12-11 09:11:33
问题 I have a question about dynamic linking on Linux. Consider the following disassembly of an ARM binary. 8300 <printf@plt-0x40>: .... 8320: e28fc600 add ip, pc, #0, 12 8324: e28cca08 add ip, ip, #8, 20 ; 0x8000 8328: e5bcf344 ldr pc, [ip, #836]! ; 0x344 .... 83fc <main>: ... 8424:ebffffbd bl 8320 <_init+0x2c> Main function calls printf at 8424: bl 8320. 8320 is an address in the .plt shown above. Now the code in .plt makes call to dynamic linker to invoke printf routine. My question is how the

Delphi link to windows dll statically or dynamically

那年仲夏 提交于 2019-12-11 06:17:32
问题 I am aware that implicitly linking to libraries at load time can lead to performance increases and as such I was wondering if it was good practice to link in this way at compile time thus increasing executable size (admittedly this is only marginal) compared to linking explicitly at runtime. My question is when linking against Microsoft Windows dll files located in System32, is it 'better' to link at load time as you can be mostly certain that the libraries will be present or follow the

Use external BLAS and LAPACK libraries in a MATLAB mex file

梦想与她 提交于 2019-12-11 04:25:59
问题 I am currently try to build an interface for a numerical software library to MATLAB. Thereby I end up with the following problem: MATLAB uses per default 64 bit integers and its BLAS and LAPACK library (namely the MKL) supports only 64 bit integers as well. Unfortunately the library which I want to connect via a mex-file to Matlab uses only 32bit integers and its dependencies too. Whenever the mex-file now tries to call a function from BLAS or LAPACK it crashes because of the different

Force Eager Initialization of Static Variables in Dynamically Linked Libs

こ雲淡風輕ζ 提交于 2019-12-11 03:57:42
问题 The C++11 Standard states, § 3.6.2, 4: "It is implementation-defined whether the dynamic initialization of a non-local variable with static storage duration is done before the first statement of main." The C++ Standard distinguishes static initializations, which requires only evaluation of compile time constants, from dynamic initialization. I believe the observable effects of eager static initialization are guaranteed. I'm interested in eager initialization in any case. Given that this

When do .so files get loaded Linux?

自古美人都是妖i 提交于 2019-12-11 02:35:29
问题 I have a shared object (a.so) which is linked to my executable myexe. a.so exposed a method called get_val(), which myexe is using. Now when a.so will be loaded into myexe's process address space? is it when myexe calls get_val() API, or when myexe gets launched. 回答1: There are two (three) types of libraries: static libraries (suffix: .a / .lib ), which itself becomes part of the binary. Strictly speaking, it's not the whole library, it's those objects from the library which are required to