Static vs. Shared Libraries

Поделиться
HTML-код
  • Опубликовано: 18 окт 2024

Комментарии • 171

  • @konstantinrebrov675
    @konstantinrebrov675 4 года назад +16

    Another pro to Dynamic Libraries is that they are Shared Libraries. If you have 80 different applications that depend on the dynamic library, they all call the same DLL at run time. They are SHARING the library. You do not have duplication of the library's code, and each executable only contains it's own code. This is why Dynamic Libraries are called Shared Libraries.

  • @belloemmanuel9399
    @belloemmanuel9399 2 года назад +9

    You might've done this 6 years ago, but this is so well explained. You've just earned one more subscriber.

  • @takumab348
    @takumab348 8 лет назад +47

    Keep making the tech videos for noob like me. much appreciated

  • @RemiStardust
    @RemiStardust 8 лет назад +10

    You making this specific video is a good example of why the internet is so great! Thank you, glad you decided to talk about this. I've seen .dll files many times over the years, never knew (nor was curious to know) what they were.

  • @dhyey2316
    @dhyey2316 9 месяцев назад +2

    Hands down best explanation of static and shared libraries. I much needed this video as I was struggling to understand this concepts.

  • @armaandhanji2112
    @armaandhanji2112 6 лет назад +6

    Hey Dave, I hope you can keep making these tech videos. I played this video during one of my college's C# classes, and everyone in the class loved it. Hope you can keep making more, they're super useful and will make for a wonderful reference in the future to come back to!

    • @DaveXiang
      @DaveXiang  6 лет назад +3

      Nice! haha wow that's cool. Yea, I haven't made a technical video in awhile, I'll have to make one

  • @vivekpal7559
    @vivekpal7559 8 лет назад +3

    Real good stuff! Feels good to get the feel of how things work under the hood in general. Keep more such videos coming!

  • @NoleoTheDog
    @NoleoTheDog 2 года назад

    Dave! You should keep making the tech videos. The simplicity of your explanation is splendid.

  • @vidhivadher9076
    @vidhivadher9076 3 года назад +3

    Extremely thankful to you Dave!!...You explained such a complex things in such an easygoing way..keep making the tech videos🔥

  • @twisted6148
    @twisted6148 2 года назад

    So who told you your videos on tech are shitty? This is the information I've spent close to 72 hours sourcing for. Great job!

  • @OnurTola
    @OnurTola 7 месяцев назад

    You explained this topic beautifully, very clear and precise. Thanks Dave.

  • @ujjwalbansal1070
    @ujjwalbansal1070 2 года назад

    Just to sum up using code:
    file.c
    #include
    int main(){
    printf("Hello");
    }
    If we compile this file using gcc then there are two ways either we use shared library to include printf() functionality or we use static library which include whole other bunch of function along with pritnf() which make our executable heavy...
    Simplely compile your above program in two ways:
    gcc -o output file.c
    gcc -o output2 -static file1.c
    And check the size of output and output2. Since output2 is statically compiled it size is greater then output file.

  • @BODAPATISASIKANTHnullRA
    @BODAPATISASIKANTHnullRA 3 года назад

    You have a really good accent. Simple and strait forward, Keep making tech videos for us! lol!!

  • @kariwattsup
    @kariwattsup 3 года назад

    As a typical highly interested in the why of stuff. I was looking in my systems and was like ..shared storage my ass... then I cancel the clear data . I came to this and wow. You do really great at teaching. I am not in this field of expertise but l can say this...I understand a whole lot more about my phone now.
    You guys use us being connected so we help give strength to the core of this huge web of shared storage...interesting.
    That's kind of cool .
    what programming or developing... I think this was a good video. Dont ever give up or not do your desire. Tech is in need of your communication style. Keep up on this stuff.

  • @JohannaLu
    @JohannaLu 6 лет назад

    I started watching your videos on sunday morning, when I was hungover ... that day changed my life... 😊

  • @jsnmad
    @jsnmad 3 года назад

    Your explanation about compile time versus run time loading of static library and shared library, respectively, was good.

  • @JamesGaehring
    @JamesGaehring 8 лет назад +1

    I'm not learning any C-like languages (yet), but this helped me better understand what's going on when I have dependency issues of any sort, whether it's managing language versions, getting frameworks up and running, linux stuff, etc. This also clarified some differences between "compile-time" and "runtime". Thx!

    • @DaveXiang
      @DaveXiang  8 лет назад

      +James Gaehring glad it was helpful! thx

  • @puremoth
    @puremoth 8 лет назад +25

    David, Im extremely grateful for what youre doing here for the newbie community. im about to undergo a web app development curriculum that stresses a slow path.. and their language of choice to teach is Ruby. do you have any opinions about Ruby as a first language?

    • @DaveXiang
      @DaveXiang  8 лет назад +5

      Ruby is a good first language for sure. Easy to write, easy to understand. Also, very popular with web programming.

    • @saadelmaaqili4051
      @saadelmaaqili4051 10 месяцев назад

      Hello , I know it's been 7 YEARS, but in the Event that you see this, how did that curriculum workout for you?

  • @pascalmathias9336
    @pascalmathias9336 Год назад

    I love how much easy you made understanding this concept. God bless you

  • @sjsoulute7953
    @sjsoulute7953 2 года назад

    This is the best explanation ive come across so far. Thanks!

  • @memoryzulu7890
    @memoryzulu7890 2 года назад

    Great video. I now understand static and shared libraries more vividly. Thank you.

  • @erickalmaraz2102
    @erickalmaraz2102 22 дня назад

    A very illuminating/intuitive explanation. Thanks!

  • @taylorz7875
    @taylorz7875 5 месяцев назад +1

    you are so good at explaining things!thanks Dave

  • @johneric2720
    @johneric2720 Год назад

    I really love this video! Detailed explanation, you broke things down to the core.
    Thank you very much😃, I really enjoyed it👍

  • @paintingmylifeawaify
    @paintingmylifeawaify 7 лет назад

    Subscribed! You are better at explaining these concepts than any professor I've ever had.

  • @lemontheme31
    @lemontheme31 6 лет назад

    Really dig your style of explanation. So calm and measured. I understood all of it. Thanks!

  • @chriswaggoner4691
    @chriswaggoner4691 7 лет назад

    0:09 my 2¢: don't worry too much about "doing well" with likes/views. Online approval can be misleading. This is a quality topic

  • @ronborneo1975
    @ronborneo1975 8 лет назад +4

    Keep making the tech vids. We love it

  • @castel3564
    @castel3564 3 года назад +1

    Although I might be wrong, but actually there is small mistake in your explanation. All the executable code or implementation of functions in particular library (at least in case C and C++) lies in DLL files. Bit in static linking of library in time of compilation a .lib file is used to find a needed function in DLL file, while in dynamic linking the process differs and a .lib file is not needed.
    So .lib files are for the static linking, but the actual code of library are contained in dll file in both cases.
    Its info on WIki:
    en.wikipedia.org/wiki/Dynamic-link_library

  • @MsJavaWolf
    @MsJavaWolf 7 лет назад

    Man, don't care too much about views for any given video. Technical videos are much appreciated and you help a lot of people.

  • @lilcannedpeach
    @lilcannedpeach 4 года назад

    10 minutes well spent thanks buddy

  • @ltecheroffical
    @ltecheroffical 9 месяцев назад

    This video is 7 years old and it aged so well even now

  • @jadsayegh6283
    @jadsayegh6283 7 лет назад +1

    Thanks for making this, very useful. We need more fundamentals like this

  • @deltashadow4154
    @deltashadow4154 6 лет назад +1

    Really good and simpler explanation. Thank you so much for this video. Subscribed !

  • @wadejbeckett
    @wadejbeckett 3 года назад

    Thank you! This is a great supplementary video to LFS201.

  • @isaacphiri6187
    @isaacphiri6187 3 года назад

    Very good and simple explanation. Easy to understand.

  • @andrewjoe1836
    @andrewjoe1836 3 года назад

    Thank you for this video, you explained chapter 1 of my linux+ book very well!

  • @cid007007
    @cid007007 4 года назад

    Learnt great stuff from your video that I was not able to answer in one of my interview and failed.. Thanks alot for such kind of stuff :)

  • @RaffaeleApetino
    @RaffaeleApetino 6 лет назад

    This explanation was pretty much perfect. Thank you!

  • @damienw4958
    @damienw4958 5 лет назад

    I use static libraries when there is less duplicated code to not worry about run time dependencies, but if I have some code that most of the rest of my project(s) need, I bung it in a shared library.

  • @oscaralejandrobedoyaobando1955
    @oscaralejandrobedoyaobando1955 6 лет назад

    Me caiste bien amigo.
    Explicas de una manera espectacular, seguire viendo todos tus videos.
    Gracias

  • @MinecraftGamer101010
    @MinecraftGamer101010 8 лет назад

    Thanks for the video, it's very educational! I also laughed a little when you told us about how you messed with some of the .dll files on your computer can bricked it as I also did that when I was a kid (was my first time seeing a blue screen).

  • @Skybuildhero
    @Skybuildhero 7 лет назад

    It's a nice overview about these types of libraries, but you tend to repeat your structure sometimes.

  • @marcuswilson1230
    @marcuswilson1230 6 лет назад

    dave Xiang is the man!!!! your videos are helping

  • @rajcodes100
    @rajcodes100 4 года назад

    Thanks Dave Xiang - very good explanation .

  • @janaro78
    @janaro78 4 месяца назад

    Great way of explaining it, thanks for video!

  • @anandareddy4931
    @anandareddy4931 8 лет назад

    Outstanding Explanation Dave Xiang..

  • @luciocardoso6306
    @luciocardoso6306 8 лет назад +1

    +Dave Xiang I've recently discovered you channel, and I think it's one of the best of its genre. Thanks a lot for all the knowledge! I would really like if you could answer one question I have: I'm currently learning C (as a first language) on Linux, and I'm reading Stephen Prata's C primer plus. Should I continue reading it, or do you recommend me another book/course?

    • @DaveXiang
      @DaveXiang  8 лет назад

      +Lucio Cardoso Nice! C is an ambitious language to learn first but should be fruitful once you understand it. I don't know about that book personally, but just make sure you can differentiate from a "reference" style vs "curriculum" style book. I would get one for each. A curriculum you can easily follow, and a reference which you can index for specifics.

  • @TenderBug
    @TenderBug 5 лет назад

    Yeah Thank you, this is very concise explanation and cleared my doubts, which I didn't know to form a query to Google search.

  • @rajcodes100
    @rajcodes100 5 лет назад

    Thanks Very much for this talk on libraries - you have touched on some cool points.

  • @HarishN24
    @HarishN24 8 лет назад

    Thanks for the great videos. Your videos gave a clear picture of what's going on under the hood..
    Can you please make a video on how linkers work, what are relocatable object codes and some info on symbol table in context of C program compilation.

  • @G33KN3rd
    @G33KN3rd 7 лет назад

    interesting vid Dave. I'm making a C interpreter as an embeddable scripting engine (C as a scripting language! lol) and I have no idea whether I should have the interpreter built as a static or a shared library so I opted for both! Should I just have it static, shared, or keep both in the case someone wants it as either shared or static? My interpreter is pretty small (50-80Kb). looking at the static library of it now, it's only 50Kb, same thing for the shared library file.

    • @DaveXiang
      @DaveXiang  7 лет назад

      Either or works, or you can just provide the source code so people can build it however they want!

    • @G33KN3rd
      @G33KN3rd 7 лет назад

      I could but the interpreter isn't 100% practical to use yet (it still needs a compiler that generates code for its VM). It is USEABLE but not practical (yet).
      Anyway, source code is on github -> github.com/assyrianic/Tagha-Virtual-Machine

  • @erdoaNNN
    @erdoaNNN 6 лет назад

    Great video man, brilliant tone and explanation flow.

  • @carloslvm
    @carloslvm 8 лет назад

    Awesome, Do you know any book that explains libraries in details? I'm learning programming and I find this topic very confusing.

  • @tejeshB19
    @tejeshB19 7 лет назад

    awesomeness​ ... 👌👌👌👌 please continue making these tech videos... I'm finally understanding coding ..... thanks a lot !! please do complete tutorials on c# ....

  • @johnernest8109
    @johnernest8109 7 лет назад +1

    Great tech video Dave, I just wanted to give some feedback and a few questions.
    Static vs Shared definitely necessitates this kind of discussion. I'm in the middle of it trying to compile Meka, a Sega Master System emulator, from Git with Allegro 5.2, ZLib, LibPNG, FreeType, and other extensions like OpenAL if I want to specify them in the Allegro build.
    So these are my questions:
    1) Sure the app size with DLLs are smaller, but isn't the file size just shifted from the app to the DLL? In that case having one DLL systemwide say in \Windows\System32 is ok, but having the same DLL all over your HDD would needlessly bog down your system.
    2) Is there a benefit other than file size of the app to be gained from using Static Libraries? In some of the projects I see ZLib for example being used as a Static Library, and I'm not sure why they don't all just use DLLs everywhere. Why do some coders seem to prefer them over Dynamic? Are there other benefits to using Static Libraries such as performance?
    Also of a side note, in the above scenario I can't seem to find a way yet to get Visual Studio 2015 to build Allegro as static libraries, when I tried manually with the built projects from cmake-gui I ran into lots of errors.
    3) When linking in a Static Library, are only the methods used copied into the application, or is the whole library used? Are multiple copies of the same class/methods copied into the end product, or just a single reference? e.g. If I have a "void Shape::Draw(void)" method that's called many times throughout an app is a copy made for each reference to the function, or just copied once?

    • @DaveXiang
      @DaveXiang  7 лет назад

      Hey, thanks for the message, let me try to answer
      1) DLL's are usually shared in 1, or a few, central locations on your computer. They won't be scattered over your file system. The whole point is that they are centralized and many other executables can all use them. There won't be a case where a shared library is "scattered" over the system unless you do it on purpose to mess around.
      2) You gain portability. With a static library that may depend on very few shared libraries, you can pretty much "drag and drop" and it will work. For shared libraries, you have to take extra care to make sure it runs properly. 1 mis matched shared library could cause executables to not work across different systems. Static libraries can safe some headache
      3) Only what it needs

  • @brianmanden
    @brianmanden 8 лет назад +1

    Thank you for another great video Dave. Keep´em coming :)

  • @andreacacioli2612
    @andreacacioli2612 4 года назад

    You explain things very well!

  • @dfhayak
    @dfhayak 3 года назад

    Thank you for explaining this so well.

  • @praveenrathode3657
    @praveenrathode3657 7 лет назад +3

    I an Indian ....Liked the way you explained ...Really Awesome explanation...Thank you so Much

    • @kudoamv
      @kudoamv 6 лет назад

      My friend is an Indian too , but he knows Grammar.
      .
      .
      .
      *No offence intended to anybody*

  • @v-ba
    @v-ba Год назад

    Cool explanation, thank you very much!

  • @leegaines2391
    @leegaines2391 6 лет назад

    You explained that very well. Thanks!

  • @ArunKumar-qo6zt
    @ArunKumar-qo6zt 4 года назад

    Thank you so much for the introduction.

  • @roberthensley7130
    @roberthensley7130 3 года назад

    great conceptual explanation of it!

  • @balaganesh3440
    @balaganesh3440 4 года назад

    dang! that's a headshot of explanation!

  • @user-og6ol2im7v
    @user-og6ol2im7v 7 лет назад

    Very well explained. Thanks a lot!

  • @34521ful
    @34521ful 6 лет назад

    Hey Dave, great video! I had a quick question. In C, when you do #Include to get the printf function, would this be "static" since the preprocessor does a literal copy and paste of that entire stdio.h file on top of my other source code? if so, what would be an example of dynamic linking? Thanks again!

    • @DaveXiang
      @DaveXiang  6 лет назад +2

      when you do the #include you get a copy and paste of the header file. you still need to link w/ the implementations. you have a choice of dynamic vs static even for standard library just as you would custom library. most often, depending on OS and compiler defaults, the standard libraries will be a shared lib on the system somewhere. Like a library like... /lib/libc.so (something like that) Don't quote me on that, but you'll have the option of doing both. If you really want, you can also statically link contents from the standard lib into your executable.

  • @randomsoul00
    @randomsoul00 10 месяцев назад

    by mean "reference"
    Do you mean it goes to an actual implementation of that function like printf whenever it is needed
    instead of copying it in our executable

  • @simpleblossom7441
    @simpleblossom7441 3 года назад

    this has helped me so much! thank you! really appreciate it.

  • @devanshuvedios
    @devanshuvedios 7 лет назад

    Very nice video.. Tech videos rock!

  • @DanielShamany
    @DanielShamany 7 лет назад

    Can you make a video on how to link to the boost library, and perhaps how to use CMake in the terminal to do all that?

  • @dogactekman2288
    @dogactekman2288 7 лет назад

    thank you so much for those explanations. subbed!!!

  • @Impulse_Photography
    @Impulse_Photography 5 лет назад

    I finally found you - - This is really good

  • @meetparikh8042
    @meetparikh8042 7 лет назад

    yes ! for me very helpful and understandable video.. thank you for sharing ...

  • @ravishankar3885
    @ravishankar3885 7 лет назад

    how can I create my own library?
    BTW, thanks for such a deep knowledge.

  • @logangraham2956
    @logangraham2956 5 лет назад

    sounds like for smaller applications at least (that use few libraries) static libraries is the way to go unless its libraries that you can almost garantee is already something the end user is using anyways.
    printing to console would be a good shared.
    but
    a highly customized graphics library might be better off as static.

  • @androidlg7311
    @androidlg7311 6 лет назад

    Can you do both? Make a project with some shared libraries and some static?

  • @ameyaupasani720
    @ameyaupasani720 8 лет назад

    excellent tutorials....i just love it...keep it up

  • @aver803bath261
    @aver803bath261 5 лет назад

    Great explanation. Thanks for sharing!

  • @ramvallabhsingh3518
    @ramvallabhsingh3518 5 лет назад

    very well explained, thank you very much.

  • @ankishamathur2625
    @ankishamathur2625 5 лет назад

    keep making tech videos :) & thanks for helping me

  • @drwblkfact7286
    @drwblkfact7286 4 года назад

    Thanks Dave!

  • @sidduvenkateswararao7996
    @sidduvenkateswararao7996 3 года назад

    Would you care to explain which would be convenient in the debugging perspective. In my immediate thought debugging with shared libs must be very hard compared static libs

  • @seyhangul1
    @seyhangul1 6 месяцев назад

    Excellent explanation.

  • @nawaryoussef
    @nawaryoussef 8 лет назад

    Thanks man, keep up the good work!

  • @Yhigma
    @Yhigma 7 лет назад

    I REALLY like the tech videos.

  • @wobble_cat
    @wobble_cat 4 года назад

    The biggest benefit of shared libraries is that you can share them across multiple projects

  • @Nicxlive
    @Nicxlive 5 лет назад

    Great Video!!! Thank you, keep on please

  • @Kugelwanze
    @Kugelwanze 7 лет назад

    Hi Dave, I have started watching your tech vids recently, I love them! I am a total newb in programing or computer science, however I am very keen to learn to program. Now, can you explain me one funny thing. Say I have subscribed to your youtube channel and when I watch your channel videos they still pop up with links "Subscribe", "Subscribe", "Subscribe"... why? :D If programmers are so tough, why they bother folks like me over and over again with this :)

  • @dadsggx56
    @dadsggx56 2 года назад

    really solid explanation!

  • @FollowTheLeeD
    @FollowTheLeeD 4 года назад

    Super helpful. Thanks man!

  • @user-or7ji5hv8y
    @user-or7ji5hv8y 5 лет назад

    that was a very good explanation.

  • @firedragonmangaming2410
    @firedragonmangaming2410 Год назад

    Great video, i understand clearly

  • @drishtidhamejani6609
    @drishtidhamejani6609 6 лет назад

    Subscribed after this

  • @armagaan009
    @armagaan009 2 года назад

    Useful even after 6 years.

  • @davidFbeckham
    @davidFbeckham 5 лет назад

    Great explanation man, thank you

  • @celineabessolo
    @celineabessolo 3 года назад

    Thanks a lot for this !

  • @mr.shredder5430
    @mr.shredder5430 8 месяцев назад

    may i ask an out of topic content, does a desktop software need a database?

  • @flowykitkat8177
    @flowykitkat8177 2 года назад

    THANK YOU!

  • @prapulkrishna
    @prapulkrishna 2 года назад

    Jus another Gold Video:)