Discussion in 'General Scripting Chat' started by Sweet Pie, Aug 1, 2011.
What is dynamic linking? and how can I use it for my adult site?
All i know about direct linking is It's about Using external, executable subroutines at runtime. The advantage of dynamic linking is that if a subroutine is changed then any executable file that links to it dynamically does not need to be changed, unless there is an obvious change to the subroutine such as the number and/or type of parameters.
When you write a program in a compiled language like C, you often need to include or import other people's libraries. Perhaps you need to include a standard library for IO (input output).
Traditionally, when you compile statically, the compiler will take all the referenced libraries, compile them into one resource, and link them with your program. This way when your program runs, it is guaranteed to have all the resources it needs.
However, what if you have 5 programs running and each program loaded its own version of some library called libx? Maybe your Chrome or Firefox browser needs libx and so does your video player. Well, it's terribly inefficient for each of these programs to statically load their own copy of libx into memory.
The solution is dynamic linking. Instead of combining libraries with your program, a dynamic link is made. Your system decides whether libx is already loaded into memory -- maybe your browser already has it loaded -- and then the library is shared between them. If the library has not been loaded, it can be dynamically loaded at run time. The difference is whether the libraries you reference are compiled and linked into your program or whether they are linked at run time.
The advantage is, it saves a lot of memory, especially since so many programs all use the same basic libraries. The disadvantage is, dynamic linking can be slower. Static linked programs are preferable when you are distributing code to someone who may not have the necessary libraries available for dynamic linking. This is often the case on embedded or mobile devices with limited memory.
Hope this helps!
Separate names with a comma.