shared-libraries

LoadLibrary Reference Counting

邮差的信 提交于 2019-12-01 18:43:32
From MSDN : The system maintains a per-process reference count on all loaded modules. Calling LoadLibrary increments the reference count. Where is that reference count stored? The actual windows loader is found in NTDLL.dll's LdrLoadDll function. This function is undocumented, and its internal functionality is subject to change in future versions of windows; only those with access to the windows source code could state for certain what happens behind the scenes. However, wine 's source is available, and you can see where it increments the reference count ; it's stored in the LoadCount member

Question on DLL Exporting/Importing and Extern on Windows

天大地大妈咪最大 提交于 2019-12-01 17:56:33
Hey guys i have some quick questions on windows dll. Basically i'm using the ifdefs to handle the dllexport and dllimport, my question is actually regarding the placement of the dllexports and dllimports as well as extern keyword. I am putting the dllimports/dllexports on the header files but do I have to put the dllexport and dllimports on the actualy definition? What about for typedefs? Do i put the dllimport/dllexport in front? as in dllexport typedef map<string, int> st_map Also regarding the extern keyword I have seen it being used like this: extern "C" { dllexport void func1(); } I have

Linking dependencies of a shared library

送分小仙女□ 提交于 2019-12-01 17:55:21
I was working with SFML, I compiled a little test program and added the linkage option -lsfml-audio . Then, I used ldd ./program to see the dynamic libraries it was linking to. Surprisingly, there were a lot, none of them had I manually selected in my makefile, nor using pkg-config --libs . I started reading about shared libraries, and made a little example to solve my doubts. However, I have this question: why some libraries need you to add the dependencies in your makefile (either manually or using a script like pkg-config ) and other libraries automatically link their dependencies? When you

“No rule to make target” error in cmake when linking to shared library

半腔热情 提交于 2019-12-01 17:28:49
In Ubuntu, I have downloaded a third-party shared library, mylibrary.so , which I have placed in the directory /home/karnivaurus/Libraries . I have also placed the associated header file, myheader.h , in the directory /home/karnivaurus/Headers . I now want to link to this library in my C++ code, using cmake. Here is my CMakeLists.txt file: cmake_minimum_required(VERSION 2.0.0) project(DemoProject) include_directories(/home/karnivaurus/Headers) add_executable(demo demo.cpp) target_link_libraries(demo /home/karnivaurus/Libraries/mylibrary) However, this gives me the error message: :-1: error: No

LoadLibrary Reference Counting

倖福魔咒の 提交于 2019-12-01 17:13:21
问题 From MSDN: The system maintains a per-process reference count on all loaded modules. Calling LoadLibrary increments the reference count. Where is that reference count stored? 回答1: The actual windows loader is found in NTDLL.dll's LdrLoadDll function. This function is undocumented, and its internal functionality is subject to change in future versions of windows; only those with access to the windows source code could state for certain what happens behind the scenes. However, wine's source is

Why would the ELF header of a shared library specify Linux as the OSABI?

佐手、 提交于 2019-12-01 16:59:45
All the standard shared libraries on my Linux system (Fedora 9) specify ELFOSABI_NONE (0) as their OSABI. This is fine - however I've received a shared library from a supplier where the OSABI given in the ELF header is ELFOSABI_LINUX (3). This doesn't sound like an unreasonable value for a shared library intended for a Linux system, however it is a different value to that of all my other libraries - and so when I try to open this library, with dlopen(), from one of my other libraries this fails with the error "ELF file OS ABI invalid". I compiled up the FreeBSD utility brandelf.c and used it

making proprietary ELF binaries portable on Linux

久未见 提交于 2019-12-01 16:59:10
I am searching for a way to make existing proprietary ELF-binaries, which are linked against specific versions of system libraries, portable. With portable I mean making the executable work on every system with the same processor architecture and a compatible system kernel, without necessarily having the source code of the libraries (if there is no way without having the source code, it'll be fine too). So far I thought of two possibilities, but I don't know if they are at all possible and if yes, which to choose: Searching all linked libraries and their dependencies and include them in a

Grub bootloader with shared library support

不问归期 提交于 2019-12-01 16:16:52
I'd like to load a shared library (closed-source binary user-space library) at boot stage with grub boot-loader. Are there any chances for this or I must write a custom-elf-loader (grub module) to do it? 29/08/2014: For more detail, this is a programming problem in which I want to customize or add some new features to Grub boot-loader project. Thank you for your all supporting! So, you don't make it crystal clear what you are trying to do, but: Loading a userspace (assuming Linux SysV ELF type) shared library straight into GRUB is not possible. GRUB modules are indeed in ELF format, but they

How-to use a shared library in native-activity

给你一囗甜甜゛ 提交于 2019-12-01 15:47:01
问题 I have an Android project with a native activity. This native activity uses a shared library named "main" (libmain.so file) for starting. ( with the code of ndk/samples/native-activity ) This app works fine. the "main" module Android.mk file : LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := main LOCAL_SRC_FILES := main.cpp LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM LOCAL_STATIC_LIBRARIES := android_native_app_glue game include $(BUILD_SHARED_LIBRARY) $(call import

C++11 compatibility with existing libraries/frameworks

本秂侑毒 提交于 2019-12-01 15:18:23
问题 I am wondering something for which I have not found a convincing answer yet. Situation: A system with some libraries (e.g. gtkmm) compiled without c++11 enabled. An application compiled with C++11 enabled. Both are compiled and linked with the same GCC version/environment. The application has some function calls to the library which use std::string and std::vector. both std::string and std::vector support move semantics which most likely mean they are not binary compatible with wth non C++11