dynamic-linking

How to determine if an OS X dylib was linked with -flat_namespace

风格不统一 提交于 2019-12-18 17:57:02
问题 I have a third party OS X dylib that I'm using in my app and don't have easy access to its creator. I'd like to determine if it was linked with -flat_namespace. Is that possible? If so, how? 回答1: Run otool -hV on the library. If you don't see TWOLEVEL , then it was linked with -flat-namespace . For example: twolevel.dylib: Mach header magic cputype cpusubtype caps filetype ncmds sizeofcmds flags MH_MAGIC_64 X86_64 ALL 0x00 DYLIB 8 672 NOUNDEFS DYLDLINK TWOLEVEL NO_REEXPORTED_DYLIBS versus

Recommendation for C++ wrapper for cross platform in-process dynamic library bindings (i.e. a lightweight, high performance COM or CORBA) [closed]

不羁岁月 提交于 2019-12-18 11:12:32
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . We're developing an application that will have a plug-in "architecture" to allow consumers of the app to provide their own proprietary algorithms. (We will basically have a set of parsers and allow third parties to provide their own as well) The domain space requires very high performance, so out-of-process

Why is fPIC absolutely necessary on 64 and not on 32bit platforms?

可紊 提交于 2019-12-18 10:20:03
问题 I recently received a: ...relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC error while trying to compile a program as a shared library. Now the solution to this is not too difficult (recompile all dependencies with -fPIC), but after some research it turns out that this problem is only present on x86-64 platforms. On 32bit any position dependent code can still be relocated by the dynamic loader. The best answer I could find is:

How does linker resolves duplicate symbols in dynamically loadable libraries?

眉间皱痕 提交于 2019-12-18 07:12:38
问题 I have two dynamically loadable libraries lib_smtp.so and and libpop.so etc. Both have a global variable named protocol which is initialized to "SMTP" and "POP" respectively. I have another static library libhttp.a where protocol is initialized to "HTTP". Now for some reason i need to compile all dynamic linkable and loadable libraries statically and include in the executable. Doing so i am getting error " multiple definition of symbol " during linking of static libraries. I am curious to

What are possible causes of “failed to map segment from shared object: operation not permitted”, and how to debug?

浪子不回头ぞ 提交于 2019-12-18 04:35:12
问题 I have two executables, both cross compiled to run in Android. I have put both on the device in the same directory. I have put all the shared libraries that they are dependent on in the same directory, including ld-linux.so.3. I run the executables by using: ld-linux.so.3 --library-path /path/to/libraries executable_name both work on older versions of Android when running as any user. The both work on the latest version of Android if running as root. Only one works on the latest version of

How to link host code with a static CUDA library after separable compilation?

淺唱寂寞╮ 提交于 2019-12-17 22:37:27
问题 Alright, I have a really troubling CUDA 5.0 question about how to link things properly. I'd be really grateful for any assistance! Using the separable compilation features of CUDA 5.0, I generated a static library (*.a). This nicely links with other *.cu files when run through nvcc, I have done this many times. I'd now like to take a *.cpp file and link it against the host code in this static library using g++ or whatever, but not nvcc. If I attempt this, I get compiler errors like undefined

CMake and order dependent linking of shared libraries

 ̄綄美尐妖づ 提交于 2019-12-17 22:33:20
问题 I have a few small components that I am building as shared libraries for my main application. Lets use an example of liba and libb . Each is built within their own subdirectory as follows: add_library(liba SHARED a.cpp) Then, in the root project folder, I need to link my main application to both. include_directories(a) include_directories(b) add_executable(dummy dummy.cpp) target_link_libraries(dummy a b) CMake runs fine with this, and my application compiles but fails to link. The problem is

How can I find which ELF dependency is not fulfilled?

為{幸葍}努か 提交于 2019-12-17 20:17:20
问题 I've built a test ELF program using the LSB SDK ( note that my question is not specific to LSB ): $ /opt/lsb/bin/lsbcc tst.c $ ls -l a.out -rwxr-xr-x 1 math math 10791 2009-10-13 20:13 a.out $ file a.out a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped But I am unable to launch it ( yes, I assure you the file is in the directory... ): $ ./a.out bash: ./a.out: No such file or directory $ uname -a Linux math 2

How to call a function from a shared library?

僤鯓⒐⒋嵵緔 提交于 2019-12-17 17:38:24
问题 What is the easiest and safest way to call a function from a shared library / dll? I am mostly interested in doing this on linux, but it would be better if there were a platform-independent way. Could someone provide example code to show how to make the following work, where the user has compiled his own version of foo into a shared library? // function prototype, implementation loaded at runtime: std::string foo(const std::string); int main(int argc, char** argv) { LoadLibrary(argv[1]); //

What do 'statically linked' and 'dynamically linked' mean?

混江龙づ霸主 提交于 2019-12-16 22:07:07
问题 I often hear the terms 'statically linked' and 'dynamically linked', often in reference to code written in C, C++ or C#. What are they, what exactly are they talking about, and what are they linking? 回答1: There are (in most cases, discounting interpreted code) two stages in getting from source code (what you write) to executable code (what you run). The first is compilation which turns source code into object modules. The second, linking, is what combines object modules together to form an