Static vs. Shared Libraries

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

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

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

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

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

    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.

  • @dhyey2316
    @dhyey2316 Год назад +2

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

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

    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.

  • @armaandhanji2112
    @armaandhanji2112 7 лет назад +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  7 лет назад +3

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

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

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

  • @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!

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

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

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

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

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

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

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

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

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

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

  • @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.

  • @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

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

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

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

    you are so good at explaining things!thanks Dave

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

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

  • @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.

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

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

  • @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!

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

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

  • @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.

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

    A very illuminating/intuitive explanation. Thanks!

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

    Keep making the tech vids. We love it

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

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

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

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

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

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

  • @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 Год назад

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

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

    10 minutes well spent thanks buddy

  • @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 :)

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

    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

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

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

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

    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

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

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

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

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

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

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

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

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

  • @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.

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

    Very good and simple explanation. Easy to understand.

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

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

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

    Outstanding Explanation Dave Xiang..

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

    This explanation was pretty much perfect. Thank you!

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

    Thanks Dave Xiang - very good explanation .

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

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

  • @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.

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

    Great video man, brilliant tone and explanation flow.

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

    Great way of explaining it, thanks for video!

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

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

  • @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).

  • @castel3564
    @castel3564 4 года назад +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

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

    Thank you for explaining this so well.

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

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

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

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

  • @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.

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

    You explain things very well!

  • @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.

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

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

  • @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?

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

    great conceptual explanation of it!

  • @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

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

    I REALLY like the tech videos.

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

    Cool explanation, thank you very much!

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

    dang! that's a headshot of explanation!

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

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

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

    Useful even after 6 years.

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

    Thank you so much for the introduction.

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

    You explained that very well. Thanks!

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

    Very well explained. Thanks a lot!

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

    Excellent explanation.

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

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

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

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

  • @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.

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

    I finally found you - - This is really good

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

    Very nice video.. Tech videos rock!

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

    Thanks man, keep up the good work!

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

    Super helpful. Thanks man!

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

    really solid explanation!

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

    keep making tech videos :) & thanks for helping me

  • @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*

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

    Thanks Dave!

  • @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

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

    How do we decide when to use static or shared libraries?

    • @DaveXiang
      @DaveXiang  4 года назад +1

      They both have pros and cons. Static is more portable but if your program is small, it may be alright. Shared libraries prevent your executables from getting too large and may be crucial for complicated applications.

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

    what is the difference between libraries and header files

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

      im pretty sure they are the same thing.
      it just has to due with the programming langauge in question.
      the c family of programing langauges use "headers" with the extension ".h"
      as far as i know there is no other difference other then what its called

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

      pretty sure they are considered static
      because everything is copied over into the executable on compilation.
      so ya header files are just very specific static library files for the C family of programming languages :)

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

    very well explained, thank you very much.

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

    that was a very good explanation.

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

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

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

    Great video, i understand clearly

  • @mr.shredder5430
    @mr.shredder5430 Год назад

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

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

    Great explanation man, thank you

  • @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.

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

    Thanks a lot for this !

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

    Great explanation. Thanks for sharing!

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

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

  • @johnernest8109
    @johnernest8109 8 лет назад +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  8 лет назад

      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

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

    Is it possible to use functions from a shared library and add them in at compile time or would you have to just download a similar static library and just use that?

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

      +soiralknarf You'll need a static version of the library.

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

    Subscribed after this

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

    Great Video!!! Thank you, keep on please

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

    thank you man.what are the advices you can give a c.s student concentrating on software engineering.

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

      +Abdoul Rachid Ayouba dont worry about learning all the latest and greatest languages and frameworks. focus all your energy on understanding how computers work and how software works.

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

      thank you Dave Xiang.but i guess learning languages is the best way to know how software works.

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

    Jus another Gold Video:)