Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

static library implementation vs including source code implementation

What are the general differences between compiling a program as a static library vs. including the source code into the program?

i.e. A program with functions that is compiled as a static library (.lib) and linked into the program vs A program with functions that is included as a source file in the main program.

Static libraries more suitable for release when releasing closed source programs? Faster compilation? etc..

like image 482
user3647412 Avatar asked May 17 '14 11:05

user3647412


1 Answers

I'd advocate inclusion of source code because:

  1. Static library is more architecture depending than source code. You will need to compile it again and again.
  2. Optionally, source code allows more optimization than linking with a pre-compiled library.
  3. When examining the program it is always better to have the possibility to see the source code than just a prototype.
like image 75
Marian Avatar answered Oct 08 '22 00:10

Marian