Making Simple Shared Object (.so) in C on Linux

  Рет қаралды 7,224

Nir Lichtman

Nir Lichtman

4 ай бұрын

Пікірлер: 36
@nirlichtman
@nirlichtman 4 ай бұрын
To avoid confusion between static and dynamic: I will clarify that both methods I have shown are dynamic (loaded on runtime and not included in the binary), the difference between them is when the library is loaded, the first method causes the operating system to load the library when the program starts and the second method enables a program to load a library whenever it wants (after being started)
@mohitkumar-jv2bx
@mohitkumar-jv2bx 4 ай бұрын
Man this channel is Gold. I know i am almost never going to write C. But knowing all these things helps understanding things better. Thanks again 🙏
@GameBacardi
@GameBacardi 4 ай бұрын
Thank you. Much simple way to show, how this work
@Crux161
@Crux161 4 ай бұрын
Simple and elegant just like it should be 😁
@xrehpicx
@xrehpicx 4 ай бұрын
This is amazingly simple cuz of how u explained it
@chexo3
@chexo3 4 ай бұрын
He does all his Linux tutorials in WSL on Windows interesting
@pouf-dk3nq
@pouf-dk3nq 4 ай бұрын
Its easier to use WSL than setting up a dual boot.
@markjenkins9424
@markjenkins9424 4 ай бұрын
@@pouf-dk3nq True. It's up to the guy. Maybe easier just to use an outright free system though.
@dylanh333
@dylanh333 2 ай бұрын
He also does a lot of Windows tutorials, so ¯⁠\⁠_⁠(⁠ツ⁠)⁠_⁠/⁠¯
@samarthtandale9121
@samarthtandale9121 3 ай бұрын
This is just awesome 🤩🔥🚀
@EmiLoomistar
@EmiLoomistar 4 ай бұрын
FInally I understand how it works :D Thankies
@FF-hy4ro
@FF-hy4ro 4 ай бұрын
great content, specially how you casually use ldd and ltrace and even though I have been coding in C for quite some time already you just taught me something new. Thank you! One small tip: the font size is too small, specially if watching it while commuting on a handheld device. Try watching it at 240p and that will tell you how somebody without the gift of perfect eyesight will see it in a moving vehicle. But again, the content is superb, thanks again!
@nirlichtman
@nirlichtman 4 ай бұрын
Thanks for the feedback! Will keep that in mind for future vids
@yash1152
@yash1152 Ай бұрын
you shouldn't watch/read any thing in a moving vehicle in the first place _"how somebody without the gift of perfect eyesight will see it in a moving vehicle"_
@modolief
@modolief 4 ай бұрын
SUPERB
@dylanh333
@dylanh333 2 ай бұрын
Can you do a video covering dynamic linking on Windows, and how it differs (and is also similar to) Linux? One thing I'm slightly perplexed by with Windows is .lib files - how do they differ in function and purpose to .h files?
@guilherme5094
@guilherme5094 4 ай бұрын
👍Man! Thanks!!
@pouf-dk3nq
@pouf-dk3nq 4 ай бұрын
Nice, the two methods look very similar, as far as i understand the first one calls the object during compile time, and the 2nd one during runtime ? Good to know !
@nirlichtman
@nirlichtman 4 ай бұрын
Both at runtime (can be confusing at first), check out the pinned comment
@pouf-dk3nq
@pouf-dk3nq 4 ай бұрын
@@nirlichtman i see, the 2nd method seems more appropriate to use because you can specify how to load the library (in case its very big) as you can call only specific functions, for example you have a program where its not always necessary to load a shared object in which you can also specify lazy loading, i assume you didn't bother check the return values in your code to make the video more simple, but if you're gonna load the entire library anyways, why not just use the first method. Are there other implications of this ?
@nirlichtman
@nirlichtman 4 ай бұрын
The first method is indeed more popular and fits in the simple case demonstrated in the video but there are some cases where the second method could be used for example if you want to load the shared object only in a specific flow in the code. Another advantage of the first method is that the shared object dependency can clearly be seen when running ldd - making it more user friendly.
@pcuser80
@pcuser80 4 ай бұрын
Question : when gcc loader. c you are not using -ldl to load the dlopen library. I get an error whitout.
@marcusk7855
@marcusk7855 4 ай бұрын
Really like the tutorials so far. Is that emacs that you are using? I've never actually taken the time to learn to use it but it seems very efficient.
@CJ1337HF
@CJ1337HF 4 ай бұрын
Its vim :)
@nirlichtman
@nirlichtman 4 ай бұрын
Indeed Vim, I have a playlist "Vim Tips" with useful info about it
@__tech_support__
@__tech_support__ 3 ай бұрын
Can you make a USB serial monitor that works in the terminal?
@rian0xFFF
@rian0xFFF 4 ай бұрын
Dynamic vs Static lib
@gerdsfargen6687
@gerdsfargen6687 4 ай бұрын
Yes please!
@nirlichtman
@nirlichtman 4 ай бұрын
Actually both methods I have shown are dynamic, check out the pinned comment for more info
@hedgehogform
@hedgehogform 4 ай бұрын
Thanks! Now I can finally execute my evil plans to make the user require a .so file or else they cannot open my app. Why not make it harder for everyone? I like suffering.
@davidfrischknecht8261
@davidfrischknecht8261 3 ай бұрын
Is there a reason you call them "shared objects" and not "shared libraries"?
@caoinismyname
@caoinismyname 3 ай бұрын
I think it's because, for Linux, shared libraries end with "so", stands for "shared objects."
@samarthtandale9121
@samarthtandale9121 3 ай бұрын
Which University course in computer would cover these basic thighs like object, library, shared object, etc please suggest ... Btw, huge fan 😁😄
@nirlichtman
@nirlichtman 3 ай бұрын
Probably CS Operating Systems course would cover some of these stuff, but the best way to truly learn this is hands on coding along with reading the docs/man pages.
The Importance of Resource Cleanup in C
7:02
Nir Lichtman
Рет қаралды 6 М.
Making Minimalist Web Server in Assembly on Linux (x64)
18:31
Nir Lichtman
Рет қаралды 35 М.
The day of the sea 🌊 🤣❤️ #demariki
00:22
Demariki
Рет қаралды 65 МЛН
Why You Should Always Help Others ❤️
00:40
Alan Chikin Chow
Рет қаралды 131 МЛН
I’m just a kid 🥹🥰 LeoNata family #shorts
00:12
LeoNata Family
Рет қаралды 11 МЛН
Making Minimalist Chat Server in C on Linux
14:28
Nir Lichtman
Рет қаралды 39 М.
Write Better Code!  |  How to Create Shared Libraries in C/C++
13:59
Low Level Learning
Рет қаралды 51 М.
The Importance of Error Handling in C
8:18
Nir Lichtman
Рет қаралды 29 М.
Windows API Memory Mapped Files Explained
8:26
Nir Lichtman
Рет қаралды 6 М.
Why Are Open Source Alternatives So Bad?
13:06
Eric Murphy
Рет қаралды 450 М.
Making Minimalist Web Server in C on Windows
10:52
Nir Lichtman
Рет қаралды 8 М.
why do header files even exist?
10:53
Low Level Learning
Рет қаралды 368 М.
Adding Simple System Call in Linux Kernel
7:44
Nir Lichtman
Рет қаралды 13 М.
How to write your own code libraries in C.
9:57
Jacob Sorber
Рет қаралды 134 М.
0x18.  C - Dynamic libraries
30:16
YpnConnect-Soft
Рет қаралды 6 М.
💅🏻Айфон vs Андроид🤮
0:20
Бутылочка
Рет қаралды 555 М.
Ждёшь обновление IOS 18? #ios #ios18 #айоэс #apple #iphone #айфон
0:57
WWDC 2024 Recap: Is Apple Intelligence Legit?
18:23
Marques Brownlee
Рет қаралды 6 МЛН
Samsung Galaxy 🔥 #shorts  #trending #youtubeshorts  #shortvideo ujjawal4u
0:10
Ujjawal4u. 120k Views . 4 hours ago
Рет қаралды 7 МЛН