- Notice that there are significant limitations on the APIs that can be used in the DLL entry point, more information in the docs about DllEntry - In this video I make a DLL that does not expose any function (only implements a basic entry point), in the future I will also talk about how to actually expose functions from a DLL and use them from other programs
There's a quote by Fred Astaire, where he said he studied 4 hours a day, 2 hours to look good and 2 more to look easy. You make everything look easy, and I know that comes from a lot of study and effort. Thanks for the inspiration!
I don't know if Windows still does this, but back when I used Win98 it annoyed me that the callback for the DLL would be called two different ways depending on whether you loaded it manually or the OS did it automatically, and it would only ever pass one cleanup message, so there were instances where your DLL might not free the memory when it exits and back then the OS definitely didn't do it for you, so certain types of exits would cause weird leaks. I would hope that even if it still behaves the same way that the OS would cleanup whatever memory you don't deallocate, but you'll have to tell me either way because it's been nearly 20 years since I used Windows.
Hi, your tutorials is perfect. It's fast and useful. Can you show simple algo, that required C for hardware optimization, and start in on unix socket? After that, I think it would be interested to call it from another language (like from php or javascript).
@@nirlichtman any complex algorithm, idk if be honest. Pi number calculation or primal number generation for example. Main goal of this idea is unix socket)
Hey i wanted to say that i love the fact that there is literally no boilerplate in ur videos, even less then in "No Boilerplate" 's ones. Like no intro at all
Actually, I didn't learn Rust yet but when I have some more time it is on my list :) Could you elaborate about what you mean about doing what Rust does in C land?
@@nirlichtman oh! so, my main takeaway from learning rust for a week is that its ecosystem is all really nicely packaged up into one binary executable called rustup. it deploys your compiler, toolchain and all the utilities into a system managed folder, keeps them updated, and maintains them
you could try making a little series on building a C/C++/Bash toolchain! Maybe a few pointers on which tools do what, and a few videos on the topic of how to configure your machine for reproducible builds
maybe set a goal-target of some sort, such as "we are going to be building a toolkit that can build linux kernel without human intervention", and you could talk about how to use the tools that are necessary to run this kind of project :)
JavaScript is actually also a nice language in my opinion (if you avoid the bad parts) I heard about Zig but I haven't tried it yet, so currently no opinion :)
@@nirlichtman In fact, I mean the creation of a DLL with a function in its simplest form. And then this function is called by a different program. In addition, a .so file application for Linux can be very nice.👌
DLLs can be used to share the same code between multiple programs without the need to duplicate the code in the program binaries, if you statically link a library your program binary will contain code from the library. The classic example for this is the C Runtime DLLs which are used by programs that are dynamically linked with the CRT so they don't need to contain CRT code within them. Another example is the Windows API built in DLLs like kernel32.dll which besides saving all programs from containing Windows library code also provide all programs with a backwards compatible interface (this is why in a lot of cases when you run old Windows programs they still work nicely on modern Windows - they use the backwards compatible windows DLLs which internally have obviously changed but externally remain very backwards compatible) There are actually two ways to load DLLs, what I showed in the video is an example of run time loading with LoadLibrary but you can also use load time loading which I will talk about in a future video
Nice video. I didn't understand the compiler option /LD, what does it do? Also I noticed that nirsDll.lib was generated, when is lib file also needed along with dll?
/LD produces .dll file. /implib:nirsDll.lib - it's not regular static library .lib file that have code in it, it's import library. It's Windows way to link dll into executable. Idk exactly how it works but compiler generates indirect function instructions inplace of calls to functions exported by import libraries.
@@nirlichtmanthat's quiet interesting. the last one i tried was based on autohotkey years ago and it was atrocious. this one seems worth a revisit to TLM on windows.
I prefer using Vim over IDEs for various reasons (explained in the welcome link on the channel description and on some of my videos on the channel) I prefer compiling and building in the command line instead of through IDE buttons since it lets me see and control exactly what is going on without the IDE abstractions, and it encourages me to understand how the compilation and linking works more deeply.
DLL is short for Dynamic Link Library and it basically is a collection of code functions exported to a separate file that can be used by multiple programs.
- Notice that there are significant limitations on the APIs that can be used in the DLL entry point, more information in the docs about DllEntry
- In this video I make a DLL that does not expose any function (only implements a basic entry point), in the future I will also talk about how to actually expose functions from a DLL and use them from other programs
Good day. Thank you a lot for your videos. Have you already prepared a video about how to actually expose functions from a DLL ?
@@pavelkosykh7416 not yet but on my list :)
This channel is underrated.
It makes simple what many programmers see as something that seems to be a cumbersome like Windows programming.
What did we do to deserve you 😄?
There's a quote by Fred Astaire, where he said he studied 4 hours a day, 2 hours to look good and 2 more to look easy. You make everything look easy, and I know that comes from a lot of study and effort. Thanks for the inspiration!
Thanks :)
Love these series. The best intro to any advanced programmer :)
Tsoding vibes!
Thank you. Glad to see how DLL works
Your content is absolutely fascinating. Thank you!
I love your videos, they're short, informative and have a high quality. Thanks for sharing and keep them up!!!!
:DDD
Your channel is AMAZING. I would love if you make more long videos!
This channel just started booming because of the recent titles, keep going man.
Very cool, very straitforward and not alot of unnecessary talks lol
you're killing it
Love how the microphone picks up the typing so loudly. Like you're angrily smashing the keyboard while typing, lol.
Your video are just simple and straight
How are you putting out SO MUCH content!? Aren't you worried about running out of ideas?! 😅 Great stuff! 👍😊
great
I don't know if Windows still does this, but back when I used Win98 it annoyed me that the callback for the DLL would be called two different ways depending on whether you loaded it manually or the OS did it automatically, and it would only ever pass one cleanup message, so there were instances where your DLL might not free the memory when it exits and back then the OS definitely didn't do it for you, so certain types of exits would cause weird leaks. I would hope that even if it still behaves the same way that the OS would cleanup whatever memory you don't deallocate, but you'll have to tell me either way because it's been nearly 20 years since I used Windows.
Hi, your tutorials is perfect. It's fast and useful. Can you show simple algo, that required C for hardware optimization, and start in on unix socket? After that, I think it would be interested to call it from another language (like from php or javascript).
Thanks! Could you elaborate? I don't really understand, what algorithm are you talking about?
@@nirlichtman any complex algorithm, idk if be honest. Pi number calculation or primal number generation for example. Main goal of this idea is unix socket)
Hey i wanted to say that i love the fact that there is literally no boilerplate in ur videos, even less then in "No Boilerplate" 's ones. Like no intro at all
The dwm font is... uh... how do I put it 😅
Btw, nice video
Well... seems that I should probably release the source code of a DLL I did decades ago... using assembler :D Even if it had its issues.
Have you considered writing a Rust series? Perhaps one to focus on cross compilation and resolving various toolchain errors?
Or potentially may we have a series on doing what Rust does in C land? Batch script creation and filesystem watching+toolchain automation?
Actually, I didn't learn Rust yet but when I have some more time it is on my list :)
Could you elaborate about what you mean about doing what Rust does in C land?
@@nirlichtman oh! so, my main takeaway from learning rust for a week is that its ecosystem is all really nicely packaged up into one binary executable called rustup. it deploys your compiler, toolchain and all the utilities into a system managed folder, keeps them updated, and maintains them
you could try making a little series on building a C/C++/Bash toolchain! Maybe a few pointers on which tools do what, and a few videos on the topic of how to configure your machine for reproducible builds
maybe set a goal-target of some sort, such as "we are going to be building a toolkit that can build linux kernel without human intervention", and you could talk about how to use the tools that are necessary to run this kind of project :)
Bro you are the reason I'm ditching JavaScript in favorite of C, also what are your thoughts on zig as a replacement?
JavaScript is actually also a nice language in my opinion (if you avoid the bad parts)
I heard about Zig but I haven't tried it yet, so currently no opinion :)
You have great videos. Is there a quick way to send and run a parameter to a function in a DLL?
You mean call a function from a DLL? Check out the rundll32 utility built in Windows
@@nirlichtman In fact, I mean the creation of a DLL with a function in its simplest form. And then this function is called by a different program. In addition, a .so file application for Linux can be very nice.👌
@@haslanhaslan yah i will have a more detailed dll vid in the future, about .so i have a vid on that :)
what is the advantage of using DLL over static linking?
DLLs can be used to share the same code between multiple programs without the need to duplicate the code in the program binaries, if you statically link a library your program binary will contain code from the library. The classic example for this is the C Runtime DLLs which are used by programs that are dynamically linked with the CRT so they don't need to contain CRT code within them. Another example is the Windows API built in DLLs like kernel32.dll which besides saving all programs from containing Windows library code also provide all programs with a backwards compatible interface (this is why in a lot of cases when you run old Windows programs they still work nicely on modern Windows - they use the backwards compatible windows DLLs which internally have obviously changed but externally remain very backwards compatible)
There are actually two ways to load DLLs, what I showed in the video is an example of run time loading with LoadLibrary but you can also use load time loading which I will talk about in a future video
@@nirlichtman thank you so much
Nice video.
I didn't understand the compiler option /LD, what does it do? Also I noticed that nirsDll.lib was generated, when is lib file also needed along with dll?
/LD produces .dll file.
/implib:nirsDll.lib - it's not regular static library .lib file that have code in it, it's import library. It's Windows way to link dll into executable. Idk exactly how it works but compiler generates indirect function instructions inplace of calls to functions exported by import libraries.
@@SirusStarTV Thanks for the info.
what window manager are you using?
I am using a port of Suckless dwm for Windows called dwm-win32
Try to make donut visualisation in c
ehh
@@xsdash what u mean ??
Sounds cool, are you talking about the ascii donut?
@@nirlichtman ya that rotating donut
We really need to use the x64 native tools or no?
If you want all the ms dev tools to be callable from terminal then yes
@@SirusStarTV ok
running windows apps in a linux window manager?
I am using Windows, check out my welcome link in the channel desc for my setup info.
@@nirlichtmanthat's quiet interesting. the last one i tried was based on autohotkey years ago and it was atrocious. this one seems worth a revisit to TLM on windows.
Why does it sound like you're slamming a hammer on your keyboard every time you press space?
why dont you use IDE for development ?
I prefer using Vim over IDEs for various reasons (explained in the welcome link on the channel description and on some of my videos on the channel)
I prefer compiling and building in the command line instead of through IDE buttons since it lets me see and control exactly what is going on without the IDE abstractions, and it encourages me to understand how the compilation and linking works more deeply.
The loudness of your keypresses is ridiculously high. Why would you wanna distract your viewers like that...
The sound of mechanical keyboard is extremely annoying.
I use link /dll, is cl /ld better?
What is this dll all about? is it like a dependency?
DLL is short for Dynamic Link Library and it basically is a collection of code functions exported to a separate file that can be used by multiple programs.