1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

What Is Dynamic Linking?

Discussion in 'General Scripting Chat' started by Sweet Pie, Aug 1, 2011.

  1. Sweet Pie

    Sweet Pie Newbie

    Joined:
    Jul 31, 2011
    Messages:
    15
    Likes Received:
    1
    What is dynamic linking? and how can I use it for my adult site?
     
  2. purewealthinc

    purewealthinc Regular Member

    Joined:
    May 3, 2010
    Messages:
    427
    Likes Received:
    383
    Occupation:
    Web Fishing
    Location:
    World Wide Web City
    Mate,

    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.
     
    • Thanks Thanks x 1
  3. Sweet Pie

    Sweet Pie Newbie

    Joined:
    Jul 31, 2011
    Messages:
    15
    Likes Received:
    1
    In English?
     
  4. Baybo.it

    Baybo.it Registered Member

    Joined:
    Aug 9, 2011
    Messages:
    72
    Likes Received:
    39
    Occupation:
    Founder of Baybo.it
    Location:
    San Francisco
    Home Page:
    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!
     
    Last edited: Aug 10, 2011