Questions tagged [static-linking]

linking that is performed in compile time, as opposed to runtime dynamic linking

Linking that is performed in compile time, as opposed to runtime dynamic linking.

See also: 'static-linking' tag at Stack Overflow:

A static library or statically-linked library is a set of routines, external functions and variables which are resolved in a caller at compile-time and copied into a target application by a compiler, linker, or binder, producing an object file and a stand-alone executable. This executable and the process of compiling it are both known as a static build of the program.

Related tag:

20 questions
27
votes
5 answers

Is there a modified LGPL license that allows static linking?

LGPL requires that it if a program uses LGPL-ed library, users must be able to re-link the program with a different version of the library: ... d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License,…
Petr
  • 5,507
  • 3
  • 29
  • 46
14
votes
1 answer

Does providing object files satisfy LGPL relink clause?

From this question on SO, I read that: Proprietary Source code + LGPL Source code statically linked: Either you must release both parts as LGPL. Or provide everything that allow the user to relink the application with a different version of the…
IvanB
  • 143
  • 1
  • 4
14
votes
4 answers

Is it important to obfuscate C++ application code?

In the Java world, sometimes it seems to be a problem, but what about C++? Are there different solutions? I was thinking about the fact that someone can replace the C++ library of a specific OS with a different version of the same library, but full…
user827992
  • 1,175
  • 2
  • 9
  • 19
13
votes
3 answers

Are Nested Static Library dependencies possible?

I am working in QT . Can a static library depend on another static library?(Static Lib is made by linking another static lib) If yes, is it possible that after linking to lib2, the generated lib(lib1) would not contain all the codes of lib2? In…
sk patra
  • 457
  • 2
  • 8
  • 12
12
votes
2 answers

Why does Apple only allow for Static Frameworks on iOS?

Clearly Apple has the ability to create dynamically loaded libraries (known as frameworks) for iOS, as they ship several with XCode (such as UIKit). App developers only have the ability to create static libraries, or at best, trick Xcode into…
Joel Fischer
  • 223
  • 2
  • 7
8
votes
2 answers

What's wrong with statically linking the STL into multiple shared libraries?

Here is the scenario: libA.so and libB.so both statically link to the same STL. libA.so has a public API that returns a std::string. libB.so calls this function and receives a copy of the string. When libB.so's copy of the string goes out of scope…
user1509041
  • 101
  • 1
  • 3
7
votes
2 answers

Is it good practice to statically link libstdc++ and/or libgcc when creating distributable binaries for Linux?

Context: I have an open source project which uses JNI. While it's possible to build it yourself, I expect most users will use standard Java tools like Maven, Gradle, or SBT to download the JAR, which contains the pre-compiled binary image. This is…
Robert Fraser
  • 391
  • 4
  • 10
7
votes
3 answers

Compiler Linking: How to handle circular references?

I'm currently writing a compiler for a new language and I'm struggling with the linking aspect of new Types when there exists a circular reference. I've created a dependency tree so that I can compile the Types in the order of their dependencies…
OnResolve
  • 421
  • 3
  • 10
6
votes
2 answers

What is the difference between a static library and an archive library?

In the comments of a recent answer, I equated a static library with an archive of compiled object files. The response was that they are not the same, so what is the difference? To clarify - gcc accepts an archive of object files as a library, as per…
Baldrickk
  • 714
  • 5
  • 12
6
votes
3 answers

Why are there two different kinds of linking, i.e. static and dynamic?

I've been bitten for the n-th time now by a library mismatch between a build and deployment environment. The build environment had libruby.so.2.0 and the deployment environment had libruby.a. One ruby was built with RVM, the other was built with…
user7146
6
votes
3 answers

C++ name mangling and linker symbol resolution

The name mangling schemes of C++ compilers vary, but they are documented publicly. Why aren't linkers made to decode a mangled symbol from an object file and attempt to find a mangled version via any of the mangling conventions across the other…
JKor
  • 175
  • 3
  • 11
3
votes
2 answers

How can there be "moral reasons" to avoid static linking?

SDL 2's installation page contains the following comment on static linking: However, we encourage you to not do this for various technical and moral reasons I totally get why they would mention technical reasons, and the document linked in the…
Wingblade
  • 207
  • 2
  • 6
3
votes
2 answers

Why use dynamic linking for less-popular libraries?

I know the difference between static and dynamic linking. I know why the notion of a library is important. And I even know why you'd want to link something like OpenGL, platform-specific APIs, or OpenSSL dynamically; lots of applications use them…
JesseTG
  • 647
  • 5
  • 13
3
votes
2 answers

How exactly does a program (executable image) and library (pre-compiled image) "link" together?

I know very well of the difference of static versus dynamic linking. What I want to know is, when linking statically (with a library like Winmm.lib on Windows), how does the linker "link" the pre-compiled format with the just compiled binary of the…
user93262
2
votes
1 answer

How can I move a library inside a project's source tree and compiling static binaries?

How can I move a library inside a project's source tree and compiling static binaries? I want to use a particular tool that utilizes ANCIENT binaries without upgrading it's API usage. This way I can use the old libraries inside the single binary…
RobotHumans
  • 906
  • 8
  • 11
1
2