Static vs. Shared Libraries

  Рет қаралды 65,582

Dave Xiang

Dave Xiang

Күн бұрын

Пікірлер: 171
@belloemmanuel9399
@belloemmanuel9399 2 жыл бұрын
You might've done this 6 years ago, but this is so well explained. You've just earned one more subscriber.
@konstantinrebrov675
@konstantinrebrov675 4 жыл бұрын
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.
@AndreiSokolov-k7j
@AndreiSokolov-k7j 7 ай бұрын
thank you master
@dhyey2316
@dhyey2316 9 ай бұрын
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 жыл бұрын
Keep making the tech videos for noob like me. much appreciated
@ehabnasr6925
@ehabnasr6925 5 жыл бұрын
+1 noob
@RemiStardust
@RemiStardust 8 жыл бұрын
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 жыл бұрын
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 жыл бұрын
Nice! haha wow that's cool. Yea, I haven't made a technical video in awhile, I'll have to make one
@OnurTola
@OnurTola 8 ай бұрын
You explained this topic beautifully, very clear and precise. Thanks Dave.
@NoleoTheDog
@NoleoTheDog 2 жыл бұрын
Dave! You should keep making the tech videos. The simplicity of your explanation is splendid.
@pascalmathias9336
@pascalmathias9336 Жыл бұрын
I love how much easy you made understanding this concept. God bless you
@vivekpal7559
@vivekpal7559 8 жыл бұрын
Real good stuff! Feels good to get the feel of how things work under the hood in general. Keep more such videos coming!
@jsnmad
@jsnmad 3 жыл бұрын
Your explanation about compile time versus run time loading of static library and shared library, respectively, was good.
@memoryzulu7890
@memoryzulu7890 2 жыл бұрын
Great video. I now understand static and shared libraries more vividly. Thank you.
@erickalmaraz2102
@erickalmaraz2102 Ай бұрын
A very illuminating/intuitive explanation. Thanks!
@JohannaLu
@JohannaLu 6 жыл бұрын
I started watching your videos on sunday morning, when I was hungover ... that day changed my life... 😊
@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.
@taylorz7875
@taylorz7875 5 ай бұрын
you are so good at explaining things!thanks Dave
@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.
@sjsoulute7953
@sjsoulute7953 2 жыл бұрын
This is the best explanation ive come across so far. Thanks!
@vidhivadher9076
@vidhivadher9076 3 жыл бұрын
Extremely thankful to you Dave!!...You explained such a complex things in such an easygoing way..keep making the tech videos🔥
@belloemmanuel9399
@belloemmanuel9399 2 жыл бұрын
I agree
@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.
@BODAPATISASIKANTHnullRA
@BODAPATISASIKANTHnullRA 3 жыл бұрын
You have a really good accent. Simple and strait forward, Keep making tech videos for us! lol!!
@JamesGaehring
@JamesGaehring 8 жыл бұрын
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
@johneric2720
@johneric2720 Жыл бұрын
I really love this video! Detailed explanation, you broke things down to the core. Thank you very much😃, I really enjoyed it👍
@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!
@lemontheme31
@lemontheme31 6 жыл бұрын
Really dig your style of explanation. So calm and measured. I understood all of it. Thanks!
@wadejbeckett
@wadejbeckett 3 жыл бұрын
Thank you! This is a great supplementary video to LFS201.
@paintingmylifeawaify
@paintingmylifeawaify 7 жыл бұрын
Subscribed! You are better at explaining these concepts than any professor I've ever had.
@lilcannedpeach
@lilcannedpeach 4 жыл бұрын
10 minutes well spent thanks buddy
@ronborneo1975
@ronborneo1975 8 жыл бұрын
Keep making the tech vids. We love it
@marcuswilson1230
@marcuswilson1230 6 жыл бұрын
dave Xiang is the man!!!! your videos are helping
@rajcodes100
@rajcodes100 4 жыл бұрын
Thanks Dave Xiang - very good explanation .
@isaacphiri6187
@isaacphiri6187 3 жыл бұрын
Very good and simple explanation. Easy to understand.
@anandareddy4931
@anandareddy4931 8 жыл бұрын
Outstanding Explanation Dave Xiang..
@andrewjoe1836
@andrewjoe1836 3 жыл бұрын
Thank you for this video, you explained chapter 1 of my linux+ book very well!
@jadsayegh6283
@jadsayegh6283 7 жыл бұрын
Thanks for making this, very useful. We need more fundamentals like this
@puremoth
@puremoth 8 жыл бұрын
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 жыл бұрын
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?
@deltashadow4154
@deltashadow4154 6 жыл бұрын
Really good and simpler explanation. Thank you so much for this video. Subscribed !
@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
@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 :)
@janaro78
@janaro78 5 ай бұрын
Great way of explaining it, thanks for video!
@oscaralejandrobedoyaobando1955
@oscaralejandrobedoyaobando1955 6 жыл бұрын
Me caiste bien amigo. Explicas de una manera espectacular, seguire viendo todos tus videos. Gracias
@RaffaeleApetino
@RaffaeleApetino 6 жыл бұрын
This explanation was pretty much perfect. Thank you!
@rajcodes100
@rajcodes100 5 жыл бұрын
Thanks Very much for this talk on libraries - you have touched on some cool points.
@Skybuildhero
@Skybuildhero 7 жыл бұрын
It's a nice overview about these types of libraries, but you tend to repeat your structure sometimes.
@andreacacioli2612
@andreacacioli2612 4 жыл бұрын
You explain things very well!
@ltecheroffical
@ltecheroffical 9 ай бұрын
This video is 7 years old and it aged so well even now
@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).
@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.
@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.
@dfhayak
@dfhayak 3 жыл бұрын
Thank you for explaining this so well.
@doandzhi
@doandzhi 6 жыл бұрын
Great video man, brilliant tone and explanation flow.
@castel3564
@castel3564 3 жыл бұрын
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
@tejeshB19
@tejeshB19 7 жыл бұрын
awesomeness​ ... 👌👌👌👌 please continue making these tech videos... I'm finally understanding coding ..... thanks a lot !! please do complete tutorials on c# ....
@randomsoul00
@randomsoul00 11 ай бұрын
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
@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.
@v-ba
@v-ba Жыл бұрын
Cool explanation, thank you very much!
@praveenrathode3657
@praveenrathode3657 7 жыл бұрын
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*
@ArunKumar-qo6zt
@ArunKumar-qo6zt 4 жыл бұрын
Thank you so much for the introduction.
@leegaines2391
@leegaines2391 7 жыл бұрын
You explained that very well. Thanks!
@roberthensley7130
@roberthensley7130 3 жыл бұрын
great conceptual explanation of it!
@brianmanden
@brianmanden 8 жыл бұрын
Thank you for another great video Dave. Keep´em coming :)
@balaganesh3440
@balaganesh3440 4 жыл бұрын
dang! that's a headshot of explanation!
@simpleblossom7441
@simpleblossom7441 3 жыл бұрын
this has helped me so much! thank you! really appreciate it.
@user-og6ol2im7v
@user-og6ol2im7v 7 жыл бұрын
Very well explained. Thanks a lot!
@drwblkfact7286
@drwblkfact7286 4 жыл бұрын
Thanks Dave!
@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.
@seyhangul1
@seyhangul1 7 ай бұрын
Excellent explanation.
@johnernest8109
@johnernest8109 7 жыл бұрын
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
@Yhigma
@Yhigma 7 жыл бұрын
I REALLY like the tech videos.
@ramvallabhsingh3518
@ramvallabhsingh3518 6 жыл бұрын
very well explained, thank you very much.
@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
@dadsggx56
@dadsggx56 2 жыл бұрын
really solid explanation!
@meetparikh8042
@meetparikh8042 7 жыл бұрын
yes ! for me very helpful and understandable video.. thank you for sharing ...
@ameyaupasani720
@ameyaupasani720 8 жыл бұрын
excellent tutorials....i just love it...keep it up
@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?
@luciocardoso6306
@luciocardoso6306 8 жыл бұрын
+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.
@dogactekman2288
@dogactekman2288 7 жыл бұрын
thank you so much for those explanations. subbed!!!
@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
@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.
@aver803bath261
@aver803bath261 5 жыл бұрын
Great explanation. Thanks for sharing!
@devanshuvedios
@devanshuvedios 7 жыл бұрын
Very nice video.. Tech videos rock!
@user-or7ji5hv8y
@user-or7ji5hv8y 5 жыл бұрын
that was a very good explanation.
@FollowTheLeeD
@FollowTheLeeD 4 жыл бұрын
Super helpful. Thanks man!
@androidlg7311
@androidlg7311 6 жыл бұрын
Can you do both? Make a project with some shared libraries and some static?
@firedragonmangaming2410
@firedragonmangaming2410 Жыл бұрын
Great video, i understand clearly
@Impulse_Photography
@Impulse_Photography 5 жыл бұрын
I finally found you - - This is really good
@nawaryoussef
@nawaryoussef 8 жыл бұрын
Thanks man, keep up the good work!
@celineabessolo
@celineabessolo 3 жыл бұрын
Thanks a lot for this !
@ravishankar3885
@ravishankar3885 7 жыл бұрын
how can I create my own library? BTW, thanks for such a deep knowledge.
@Nicxlive
@Nicxlive 5 жыл бұрын
Great Video!!! Thank you, keep on please
@ankishamathur2625
@ankishamathur2625 6 жыл бұрын
keep making tech videos :) & thanks for helping me
@davidFbeckham
@davidFbeckham 5 жыл бұрын
Great explanation man, thank you
@34521ful
@34521ful 7 жыл бұрын
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 7 жыл бұрын
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.
@drishtidhamejani6609
@drishtidhamejani6609 6 жыл бұрын
Subscribed after this
@flowykitkat8177
@flowykitkat8177 2 жыл бұрын
THANK YOU!
@armagaan009
@armagaan009 2 жыл бұрын
Useful even after 6 years.
@snehakulkarni149
@snehakulkarni149 6 жыл бұрын
Awesome .... thankyou so much
@ehabnasr6925
@ehabnasr6925 5 жыл бұрын
very informative thanks a lot.
@fahad9739
@fahad9739 8 жыл бұрын
Thanks for the video
@nagesh007
@nagesh007 2 жыл бұрын
Awesome, Thanks
Static and Dynamic Linking on Linux with gcc
27:09
embeddedarmdev
Рет қаралды 47 М.
How Strong is Tin Foil? 💪
00:25
Brianna
Рет қаралды 60 МЛН
Wait for the last one 🤣🤣 #shorts #minecraft
00:28
Cosmo Guy
Рет қаралды 23 МЛН
Creating and Linking Static Libraries on Linux with gcc
16:27
embeddedarmdev
Рет қаралды 31 М.
How do linkers resolve symbols? Systems Programming CS Lecture
33:19
Code Libraries - Computerphile
8:45
Computerphile
Рет қаралды 93 М.
Using Libraries in C++ (Static Linking)
18:43
The Cherno
Рет қаралды 444 М.
Header files and libraries (Kevin Lynch)
9:32
Northwestern Robotics
Рет қаралды 96 М.
Personal Branding for Software Developers
10:20
Dave Xiang
Рет қаралды 9 М.
why do header files even exist?
10:53
Low Level
Рет қаралды 425 М.
Creating and Linking Shared Libraries on Linux with gcc
29:12
embeddedarmdev
Рет қаралды 22 М.