View previous topic :: View next topic |
Author |
Message |
EvilN n00b
Joined: 13 Feb 2003 Posts: 47 Location: Stockholm, Sweden
|
Posted: Thu Jun 19, 2003 11:13 am Post subject: Sorry but I got to ask... |
|
|
Major n00b question.
I see a lot of programs that can be compiled both dynamic and static or are pre compiled dynamic or static.
I have no idea what the diefference is so if anybody could give me a really brief explanation I'd be greatful.
An example:
http://www.iglooftp.com/unix/download.html _________________ Juniper Networks Certified Internet Associate
JNCIA-M #0090 |
|
Back to top |
|
|
skunkworx Guru
Joined: 02 Feb 2003 Posts: 420 Location: Planet Houston
|
Posted: Thu Jun 19, 2003 11:46 am Post subject: Answer |
|
|
Assuming they aren't referring to something else entirely, static and dynamic refer to how the program references standard function libraries, such as the input/output routines used by almost all programs written in C and C++. Static programs have these libraries compiled directly into the program. Dynamic programs attach themselves to dynamic link libraries (DLL files) stored somewhere on your computer. Static programs are easier to transport, because all the code they need is right there in the program. Dynamic programs, on the other hand, are smaller and more versatile, since the DLLs can be updated without recompiling the program.
---Kris Kelley |
|
Back to top |
|
|
miwjpa n00b
Joined: 16 Mar 2003 Posts: 21
|
Posted: Thu Jun 19, 2003 11:51 am Post subject: static and dynamic linking |
|
|
If you're referring to static and dynamic linking here's my explanation:
Generally all programs call machine code in other libraries. A library in this case is a file containing a collection of object code files (often .o files). A library can be either static (foo.a) or shared (dynamic) (foo.so). If you use a static library it will be joined/linked with your code when you compile it. If you use a shared/dynamic library only a small part of the library is linked/joined with your compiled program. The shared library is then dynamically loaded on execution of your program.
Advantages with static libraries: Your program comes as a complete unit with respect to the static library. Your don't have to depend on the user having a copy of the library installed. You know what code your program uses.
Disadvantages: Larger size of your compiled program (mainly on disk). If you need to change something in the static library you need to recompile and distribute your program as a whole.
Advantages with shared libraries: The library code can be shared between different programs which means your program is smaller on disk. Shared libraries often share memory while loaded which means less memory usage. Easier to update.
Disadvantages: You must make sure the user uses a version of your library which supports whatever you need in it.
If you compare with the Windows platform, shared/dynamic libraries are the DLL files and static libraries use the LIB extension. |
|
Back to top |
|
|
wallace1819 Apprentice
Joined: 17 Aug 2002 Posts: 195 Location: VT
|
Posted: Thu Jun 19, 2003 12:38 pm Post subject: security |
|
|
there is also a security issue. If a vuln is found in a library, you may need to recompile each application you staticly compiled with that library. This requires you to keep track of what app you compiled staticly with what libraries.
wallace |
|
Back to top |
|
|
|