Questions tagged [linking]

34 questions
44
votes
3 answers

Can I link to a GPL library from a closed source application?

Okay, before everyone goes shouting about duplicate questions, yes, I've already seen several questions like this here. But none answer the question. If I link against a GPL-ed library without modifying that library, do I need to release my source…
john-charles
  • 668
  • 1
  • 6
  • 6
22
votes
7 answers

Why do we need to include the .h while everything works when including only the .cpp file?

Why do we need to include both the .h and .cpp files while we can make it work solely by including the .cpp file? For example: creating a file.h containing declarations, then creating a file.cpp containing definitions and including both in…
reaffer
  • 355
  • 1
  • 2
  • 5
18
votes
1 answer

Why is the code section called a text section?

The section of an executable that contains code is sometimes called the .text section. In segmented memory architectures, a segment mapped as code is sometimes called a text segment. The unix error message “text file busy” (ETXTBSY) means “this file…
16
votes
3 answers

Should I add the source of libraries instead of linking to them?

I'm relatively new to C++, so I'm not sure how I should best handle small dependencies (e.g., a scripting language, or a JSON/YAML/XML Parser). Should I create separate projects and link them as static library, or are there downsides of just putting…
Michael Stum
  • 1,778
  • 2
  • 17
  • 22
9
votes
2 answers

Apollo-11: Using inclusion instead of a linker

Recently digitized and turned into a repo, the original Apollo 11 guidance computer source code has been made available for viewing on Github. In MAIN.agc, the repo author comments that they split the huge monolithic source code into smaller, more…
8protons
  • 1,359
  • 1
  • 10
  • 27
9
votes
2 answers

Questions about linking libraries in C

I am learning C (still very much a beginner) on Linux using the GCC compiler. I have noticed that some libraries, such as the library used with the math.h header, need to be linked in manually when included. I have been linking in the libraries…
james
  • 93
  • 1
  • 5
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
2 answers

Can I distribute a GPL executable (not a library) in a closed-source application?

I want to write a closed-source desktop application that uses a piece of GPL software in the background. I know that I can't link to a GPL library (libgit.a). But if I embed a GPL application (git.exe) into a closed source application, unzip the…
Ned Twigg
  • 489
  • 4
  • 6
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
5
votes
1 answer

What does the 'emulation' do in the Linker?

I am looking into assembler and I am trying to understand the whole compilation process. During the linking step I use: ld -m elf_i386 -s -o hello hello.o Everything works fine, but I do not understand what the -m parameter does. In the manual it…
AK_is_curious
  • 286
  • 1
  • 7
5
votes
4 answers

What are the benefits of using meta tag/JavaScript redirection over HTTP header redirection?

Upon inspecting Twitter's URL shortening service http://t.co, I noticed that, instead of redirecting to the goal URL using a Location HTTP header and a 3xx HTTP status code, it redirects using the following HTML (formatted for better…
Decent Dabbler
  • 570
  • 2
  • 16
5
votes
1 answer

How do programming languages integrate with OS runtimes

For example, Objective-C, Swift and Ruby (i.e. RubyMotion) integrate with the Cocoa framework. Is this done via linked libraries? I assume they call functions in existing binaries instead of simply recreating some common interface.
4
votes
1 answer

How would I organize a C project that uses libraries?

First off, I'm relatively new to C - I know the language somewhat, but never looked too much into the whole build process. From what I'm seeing, if I want to use a third party library and have it in source code form, I would compile that library…
Michael Stum
  • 1,778
  • 2
  • 17
  • 22
4
votes
2 answers

How should an embedded OS be combined with user code?

As a side-effect of an embedded project I've been working on, I've developed a small operating system for an ARM processor. While the OS and my user code are in separate directories and have clean boundaries between them, they're built into a single…
Isvara
  • 610
  • 6
  • 18
4
votes
2 answers

May non-GPL-compatible scripts be linked at runtime to a GPLv3 library, by that (GPL) library itself?

First of all, pardon the title, as it's not very clear. I have an application I am writing that is GPLv3, and is in Java, which means that classfiles are generated and linked to for general operation. I am also using a scripting engine which, for…
nanofarad
  • 452
  • 5
  • 17
1
2 3