C++ Dynamic Linking vs Static Linking

C++ Dynamic Linking vs Static Linking

Jamie King

10 лет назад

105,500 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@thewelder3538
@thewelder3538 - 11.05.2023 17:06

This is now a good example of static vs dynamic linking at all. In fact, it's wildly misleading in some cases. I do appreciate the effort though.

There's a fundamental difference between statically linking a .lib file and statically linking against a .dll file. Firstly, if you're statically linking against a lib, you don't need to dllexport the functions you want to expose. If you're creating a .dll file then that's where you need dllexport to export the calls in the dll. If you're dynamically loading the dll, then you'll use LoadLibrary(), GetProcAddress() to get handles to the functions of the dll. However, you can also statically link against a dll.

Ответить
@andsoehd277
@andsoehd277 - 20.11.2022 07:42

can i link staticly non standard library with just g++ -Wall -o prog prog.cpp - static?

Ответить
@ChristopherGray00
@ChristopherGray00 - 16.08.2022 15:11

i appreciate the video but could you not yell? no offense but it's very loud

Ответить
@SanmathiBharamgouda
@SanmathiBharamgouda - 15.08.2022 20:29

still the best explanation on internet for the static/dynamic linking

Ответить
@tohtorizorro
@tohtorizorro - 12.08.2022 07:14

thinking about the energy wasted in typing 'using namespace std' and having to mention about it (how it is a bad practice) vs typing 'std::' I'd be curious to know why still do it.

Ответить
@kristinmccounaughy3556
@kristinmccounaughy3556 - 18.07.2022 15:26

can you please help me compile a bunch of fortran codes which create an EXE [ which does not report missing dlls]

Ответить
@alexanderdorenkamp7160
@alexanderdorenkamp7160 - 19.03.2022 07:37

I think I grew 100 brain cells. Great video!

Ответить
@jonathanwyble4227
@jonathanwyble4227 - 15.03.2022 05:52

But your new dynamic library might have foo() instead of moo() and then you'd be in "dll hell" 😄

Ответить
@korokitsune
@korokitsune - 28.01.2022 04:24

This is the most straight forward explanation I have heard. Thank you!

Ответить
@williankoessler5935
@williankoessler5935 - 30.11.2021 20:37

I would love to see another video explaining the "static-dynamic" linking vs completely dynamic linking

Ответить
@marcello4258
@marcello4258 - 12.11.2021 01:16

thanks I am not really a C(/++) programmer but it was quite comprehensive thanks for that.. and well btw.. you might should do smth against your sleeping problems doing such thing at 5.00 in the morning ;)

Ответить
@bhupiistersingh4097
@bhupiistersingh4097 - 09.08.2021 12:59

Amazing sir... just amazing...

Ответить
@meletispogkas1475
@meletispogkas1475 - 30.06.2021 11:11

Hello Jamie, what if I (the comsumer of your library) use a way newer compiler than what you used to produce your lib and dlll files . Can there be an issue?

Ответить
@IsaacC20
@IsaacC20 - 29.01.2021 06:16

1/28/2021 Still works B)

Ответить
@jackbutler4903
@jackbutler4903 - 30.12.2020 22:23

Absolutely killed it!!! Perfect demo! Ty, will definitely share your content!

Ответить
@ryandetzel848
@ryandetzel848 - 28.12.2020 14:46

Over 7 years later and this is still very helpful. Thanks!

Ответить
@ImmortalityYT
@ImmortalityYT - 27.11.2020 02:32

Wonderful explanation thank you so much!

Ответить
@clearwavepro100
@clearwavepro100 - 16.11.2020 20:31

6 years later... same for me... needed to lock it in after a long time of being semi-locked in... Thanks Jamie!

Ответить
@leonlysak4927
@leonlysak4927 - 12.11.2020 02:11

This video aged well. Amazing explanation Jamie

Ответить
@jefegamez6284
@jefegamez6284 - 08.09.2020 18:27

You are a good teacher!

Ответить
@sovanraksa2112
@sovanraksa2112 - 25.08.2020 10:42

Thank you, Jamie

Ответить
@nexovec
@nexovec - 16.07.2020 02:06

Does the linker just ignore any unresolved references if I decide to link against a single dll file?

Ответить
@ohaRega
@ohaRega - 15.07.2020 02:58

That was soooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo friggin GOOD

Ответить
@joshuasegal713
@joshuasegal713 - 25.06.2020 17:30

Are there any benefits to statically linking over dynamically? Is it faster because the library is copied and pasted into the exe?

Ответить
@bartff5568
@bartff5568 - 20.06.2020 15:54

still helpfull in 2020

Ответить
@diegodorado
@diegodorado - 06.09.2019 02:37

nicely explained!

Ответить
@akhileshverma3729
@akhileshverma3729 - 01.06.2019 23:00

Best video ever

Ответить
@MrGryph78
@MrGryph78 - 25.02.2019 11:23

I was your 2^16th viewer for this video \o/

Ответить
@halotroop2288
@halotroop2288 - 03.02.2019 08:01

I think this was just what I needed to understand how to eliminate DLLs from my project so it can be run on a platform not designed to use DLLs.

Ответить
@haos4574
@haos4574 - 03.01.2019 07:47

really good explanation, damn! I understand it now!!!

Ответить
@ionsuberviola1567
@ionsuberviola1567 - 01.10.2018 15:47

Great video! I have a question: where must the DLL be for the .exe to find it? always in the same folder as the .exe?

(It would also be great if you could explain us the implicit vs explicit linking within the dynamic-linking of libraries. Is it possible to link implicitly, if no .lib file is provided?)

Ответить
@backend-Engineer555
@backend-Engineer555 - 29.09.2018 11:50

Thanks Jamie, your video makes my mind clear about what the difference DLL and lib. This is so cool

Ответить
@ConnorAZ
@ConnorAZ - 14.08.2018 15:43

sir when i am compling the dll with this command

cmd : cl /LD /Main.dll Main.cpp

this is only generating the dll file not the lib file what is wrong
How am I Suppose To Link The exe with The Dll If There is no lib file ????
and one more thing the compiler says ignoring the unknown parameter /Main.dll
which I am supposing telling compiler the name of the dll File am I doing something wrong
if this video is not working for vs 2013 command line then please make a video for each and every version of vs(Visual Studio Express Version) { Low End Pc }

Ответить
@jackdaniel8763
@jackdaniel8763 - 13.07.2018 22:22

Hi Jamie King , you humor make complicated matters easy and cristal clear, After a year of hard working to understanD almost C++ Programming and compiling concepts ,I still feel that I don't hold really on Programming ! What do you counsel me to do? Thank you Beforehand

Ответить
@raymondlu9232
@raymondlu9232 - 29.06.2018 17:29

thank you Jamie, it really helps me a lot.

Ответить
@davodeky
@davodeky - 25.05.2018 08:30

This video totally made sense...Could you do a video on threads?

Ответить
@huatsonmx
@huatsonmx - 23.02.2018 08:42

mooooooooooer

Ответить
@user-cc8kb
@user-cc8kb - 19.02.2018 19:01

Thanks Jamie. Cool video!

Ответить
@TuNguyen-ox5lt
@TuNguyen-ox5lt - 22.11.2017 06:50

absolutely amazing . You just make everything as clear as possible . Examples are great and easy to gasp . Thank you anyways for your great works .

Ответить
@harshadfx
@harshadfx - 23.08.2017 13:36

Hey, great video lesson man!!
Question: in Static Linking Library, what are the files Mainer.exp and Mainer.lib for?

Ответить
@paramarthasaha
@paramarthasaha - 03.06.2017 15:54

What happens if we delete .lib file in static linking??

Ответить
@slackwareguyguess3585
@slackwareguyguess3585 - 30.05.2017 15:50

Very nice thanks

Ответить
@RayKhuboni
@RayKhuboni - 17.05.2017 12:42

Awesome video. Thanks.

Ответить
@Turjak_art
@Turjak_art - 02.03.2017 16:48

thank you that was a good explenation

Ответить
@MRGCProductions20996
@MRGCProductions20996 - 22.02.2017 23:30

is visual studio mandatory?

Ответить
@glexmad
@glexmad - 12.02.2017 13:04

Very good man... Very good!! :)

Ответить
@melvyniandrag
@melvyniandrag - 28.01.2017 07:30

wonderful video very helpful

Ответить