dynamic-linking

Shared library mysteriously doesn't get linked to application

人盡茶涼 提交于 2019-12-08 01:35:58
问题 I have a shared library (libhoard.so) that I'm trying to link with a simple test binary. However, depending on the machine I compile on the shared library doesn't show up in the test binary. I'm not sure what differences exist on the machines and is partly why I'm asking the question. I'm curious what I can do to troubleshoot why the shared library doesn't show up on the test binary on the "broken" machine? I used this command to compile both binaries (libhoard.so is in the same directory): $

Function interposition only working for malloc not free

橙三吉。 提交于 2019-12-07 23:29:34
问题 I've come across a small problem while monitoring malloc and free trough the use of function interposition. When performing the function interposition for just malloc, it works as exepcted. However, when trying to interpose free as well it ends up in a loop; i seems like free is recursivly invoked but i just dont know why. This is the code for the malloc and free functions. (mod_malloc_free.c) #define _GNU_SOURCE #include <stdio.h> #include <stdint.h> #include <dlfcn.h> void* malloc(size_t

linking and paging in the system without virtual memory support

萝らか妹 提交于 2019-12-07 15:00:12
问题 First of all, is virtual memory a hardware feature of the system, or is it implemented solely by OS? During link-time relocation, the linker assigns run-time addresses to each section and each symbol, in the generated executable Do those run-time addresses correspond to virtual addresses? What if the system for which the executable is generated, does not use virtual memory? Next, if virtual memory is not used, then the application's address space is limited to the physical address space

OpenCL C/C++ dynamic binding library (win32 and more)

久未见 提交于 2019-12-07 13:26:30
问题 I'm giving a try at OpenCL, and in order to put this in production I'd like to be able to bind dynamically to OpenCL.DLL (when under Windows), in order to handle 'gracefully' the case where no OpenCL is installed on the host computer. Is there any available library (or code snippet) that takes care of this dynamic binding in C or C++, much like GLEW does for OpenGL ? I'd like to avoid the hassle to do it myself. Thanks, 回答1: Here you go: http://clcc.sourceforge.net/clew_8h.html 回答2: Since you

Dynamically Linking Python Extension (.pyd) to Another Extension

ぃ、小莉子 提交于 2019-12-07 11:37:12
问题 Python Extension modules are just dynamic libraries, so I assume it's possible to dynamically link a Python extension to another. The problem is on Windows Python Extensions are are given the .pyd extension instead of .dll , so I can't get distutils to link to them when I run the setup script. (I don't think this is a problem on UNIX because Python extensions use the .so file extension.) Assume I have an extension bar.pyd which needs to link to foo.pyd . Basically, what I did in the setup

How to set RPATH and RUNPATH with GCC/LD?

為{幸葍}努か 提交于 2019-12-07 03:54:23
问题 I recently encountered this problem after an upgrade of the system: using the GCC -Wl,-rpath= option works differently than before. I used it to set the search paths to some shared libraries that were built in a sub-module of my project. At the time I considered it better than setting LD_LIBRARY_PATH system-wide (I didn't want to set it every time I turned on the computer). Everything worked fine, and these two approaches seemed equivalent. Now it seams that the behavior of -rpath has changed

CMake on Linux: “target platform does not support dynamic linking”

霸气de小男生 提交于 2019-12-06 20:24:35
问题 I have the very simple CMakeLists.txt CMAKE_MINIMUM_REQUIRED(VERSION 2.8) FIND_PACKAGE(VTK REQUIRED) PROJECT(test CXX) that really doesn't do anything. The package VTK is correctly found under /usr/lib/vtk-5.8/VTKConfig.cmake . This file includes a number of statements of the type ADD_LIBRARY(foobar SHARED IMPORTED) to indicate that the shared library libfoobar.so will need to be linked in executables. Upon creating Makefiles using the above script, however, CMake will complain that CMake

Linking QtCreator && OpenCv

南笙酒味 提交于 2019-12-06 16:39:37
I'm having a problem linking a library from opencv(2.3.1) and can't find a way to resolve it.. I'm using qtCreator with mingw and the pre-built vc10 dynamic lib files. So, here is what I have done till now: .pro file: TEMPLATE = app INCLUDEPATH += "E:/opencv/build/include/" INCLUDEPATH += "E:/opencv/build/include/opencv/" INCLUDEPATH += "E:/opencv/build/include/opencv2/" INCLUDEPATH += $$PWD/../opencv/build/x86/vc10 DEPENDPATH += $$PWD/../opencv/build/x86/vc10 win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../opencv/build/x86/vc10/lib/ -lopencv_core231 else:win32:CONFIG(debug, debug

Measure time taken dynamically linking at program startup?

和自甴很熟 提交于 2019-12-06 14:55:26
How can I measure the time spent dynamically linking at program startup? Solutions that come to mind and why I'm hesitant: 1) Print something the time right before running the program and at the start of main. This doesn't take into account possible code that runs before main -- initialization of globals and any resulting function calls. It's not automated out of the box and well, it strikes me as crude and of dubious accurately. 2) time command on an empty program that has all the same headers as the program to be tested and is dynamically linked to the same libs. I'm not sure about this one.

Function interposition only working for malloc not free

為{幸葍}努か 提交于 2019-12-06 10:28:47
I've come across a small problem while monitoring malloc and free trough the use of function interposition. When performing the function interposition for just malloc, it works as exepcted. However, when trying to interpose free as well it ends up in a loop; i seems like free is recursivly invoked but i just dont know why. This is the code for the malloc and free functions. (mod_malloc_free.c) #define _GNU_SOURCE #include <stdio.h> #include <stdint.h> #include <dlfcn.h> void* malloc(size_t size) { static void* (*real_malloc)(size_t) = NULL; printf("%s\n", "inside shared malloc"); if(!real