Questions tagged [dynamic-library]

Compiled binaries capable to be loaded in the process address space in runtime.

Dynamic Libraries are compiled binaries capable of being loaded/unloaded into/from the process address space at runtime.

In the Unix world, they are called shared libraies; in the Windows world, they are known as DLLs (dynamically-loadable libraries).

They can be loaded simultaneously into multiple processes, saving RAM and disk space.

Their file format is similar to, or even the same as, that of binary executables.

484 questions
27
votes
3 answers

C++ Statically linked shared library

I have a shared library used by a another application beyond my control which requires *.so objects. My library makes use of sqlite3 which needs to be statically linked with it (I absolutely need a self-contained binary). When I try to compile and…
Petr
  • 1,128
  • 2
  • 14
  • 23
25
votes
3 answers

Linking Rust application with a dynamic library not in the runtime linker search path

I have a shared library that I'd like to dynamically link into several separate binary Cargo applications. I include its location in the linker using the -- -L /path/to/dir format and the application compiles correctly with the significant decrease…
Ameo
  • 2,307
  • 5
  • 21
  • 33
23
votes
1 answer

Is the function 'dlopen()' private API?

I want use function 'dlopen()' to invoke a dynamic library on iOS platform, is the function 'dlopen()' private API?
Donald
  • 321
  • 1
  • 2
  • 10
21
votes
6 answers

relocation against xxx in read-only section '.text' - wrong compiler or linux setup in SUSE?

I'm not a frequent user of Linux and I think I did something wrong. This is the code for a test dynamic library ".so" I'm generating. class InternalClass { public: int Function(){ return 10; } }; extern "C" { int WrapperFunctionSimple() {…
Darkgaze
  • 2,280
  • 6
  • 36
  • 59
19
votes
4 answers

Difference between static and dynamic library in Xcode for iPhone

What is the difference between a static and dynamic library in XCode? And why doesn't Apple allow us to use dynamic libraries in our iOS applications?
prajakta
  • 673
  • 6
  • 26
18
votes
1 answer

clang, change dependent shared library install name at link time

Related, but do not answer the question: How do I modify the install name of a .dylib at build time On OSX, I have a dynamic library provided by a packager manager, installed in a non standard directory, which install_name is just the filename.…
user744629
  • 1,961
  • 1
  • 18
  • 27
18
votes
2 answers

MacOS -- how to link a dynamic library with a relative path using gcc/ld

If you are trying to understand dynamic linking, this question is likely to be of interest. One of the answers to that question provides a wonderful example of creating and using a dynamic library. Based on it, I some simple files: main.c: extern…
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
17
votes
2 answers

Singleton class in a static library

Suppose I have a singleton class S in a static library, this could be linked with the other dynamic libraries D1 D2 D3, So from what I understand the class S will have a separate instance in each D1, D2 and D3 and this would be true even if it is…
tejas
  • 1,795
  • 1
  • 16
  • 34
15
votes
1 answer

Can I export functions of a static library when building a dynamic library linking against that static library?

On win32, I built a dynamic library called A.dll which linked against a static library called B.lib, and also built a executable called C.exe which only dependent on A.dll. But now, in C.exe if I want use a function foo which only has definition in…
Francis
  • 737
  • 1
  • 7
  • 21
14
votes
2 answers

Global variables, shared libraries and -fPIC effect

I made a piece of code which consists in a dynamic library (lib.c), and a main executable (main.c). In both files I define a global variable named: int global. Not very smart but it's not the question. When I compile the dynamic library the -fPIC…
yota
  • 2,020
  • 22
  • 37
13
votes
1 answer

Load a Mac binary as a dynamic library

I am doing some reverse engineering with a binary executable without sources. On Windows what I can do is load an executable file (EXE) with LoadLibrary, just as it was a DLL file. If the loaded file is not relocatable I can simply relocate my…
kuba
  • 7,329
  • 1
  • 36
  • 41
11
votes
3 answers

Xcode Creating a framework that has cocoapods dependencies

I'm currently developing a framework for internal usage, but I'm having trouble getting it to play nicely. The issue i seem to be having is that the framework uses cocoapods for some of its dependencies, and then when I tried to test is in a blank…
Genhain
  • 1,937
  • 1
  • 19
  • 38
11
votes
0 answers

Debugging a dynamically-loaded library with gdb

I am trying to debug an application which loads dynamic libraries as plugins, and experiencing problems with gdb to locate the source files and put breakpoints at the source level. I build a dynamic library (libFoo.so) which is compiled with a…
Louen
  • 3,617
  • 1
  • 29
  • 49
11
votes
3 answers

Manually call a rust dynamic library

I'm currently playing around with DynamicLibrary. The code of my dynamic library (compiled with rustc --crate-type dylib dylib.rs): // dylib.rs #[no_mangle] pub fn minicall() -> u8 { 3u8 } And the code to call it: // caller.rs use…
Levans
  • 14,196
  • 3
  • 49
  • 53
10
votes
1 answer

What's the meaning of dylib files?

My C++ compiler creates "dylib" files which contain dynamic libraries. Whats the difference between .dylib and .so files? And what is the difference between files in Mach-O format and files in an ELF format? I have to build files for later use…
Marc Schlösser
  • 751
  • 2
  • 8
  • 17
1
2
3
32 33