Making Simple Windows DLL in C

Sdílet
Vložit

Komentáře • 70

  • @nirlichtman
    @nirlichtman  Před 6 měsíci +21

    - 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

    • @pavelkosykh7416
      @pavelkosykh7416 Před 20 dny +1

      Good day. Thank you a lot for your videos. Have you already prepared a video about how to actually expose functions from a DLL ?

    • @nirlichtman
      @nirlichtman  Před 20 dny

      @@pavelkosykh7416 not yet but on my list :)

  • @informagico6331
    @informagico6331 Před 6 měsíci +35

    This channel is underrated.
    It makes simple what many programmers see as something that seems to be a cumbersome like Windows programming.

  • @kristaqvin
    @kristaqvin Před 6 měsíci +42

    What did we do to deserve you 😄?

  • @user-tz1bb4jc5v
    @user-tz1bb4jc5v Před 6 měsíci +13

    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!

  • @akinevz_
    @akinevz_ Před 6 měsíci +2

    Love these series. The best intro to any advanced programmer :)

  • @jintz2
    @jintz2 Před 6 měsíci +5

    Tsoding vibes!

  • @GameBacardi
    @GameBacardi Před 6 měsíci +4

    Thank you. Glad to see how DLL works

  • @cuarto_piso
    @cuarto_piso Před 6 měsíci +2

    Your content is absolutely fascinating. Thank you!

  • @voluptua
    @voluptua Před 6 měsíci +3

    I love your videos, they're short, informative and have a high quality. Thanks for sharing and keep them up!!!!
    :DDD

  • @caiomadeira9293
    @caiomadeira9293 Před 4 měsíci

    Your channel is AMAZING. I would love if you make more long videos!

  • @ryuk_shinigami
    @ryuk_shinigami Před 6 měsíci

    This channel just started booming because of the recent titles, keep going man.

  • @aah134-K
    @aah134-K Před 6 měsíci +1

    Very cool, very straitforward and not alot of unnecessary talks lol

  • @littlecurrybread
    @littlecurrybread Před 6 měsíci

    you're killing it

  • @SpringySpring04
    @SpringySpring04 Před 6 měsíci

    Love how the microphone picks up the typing so loudly. Like you're angrily smashing the keyboard while typing, lol.

  • @rian0xFFF
    @rian0xFFF Před 6 měsíci +2

    Your video are just simple and straight

  • @MadMathMike
    @MadMathMike Před 6 měsíci

    How are you putting out SO MUCH content!? Aren't you worried about running out of ideas?! 😅 Great stuff! 👍😊

  • @dmeadutube
    @dmeadutube Před 6 měsíci

    great

  • @anon_y_mousse
    @anon_y_mousse Před 6 měsíci

    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.

  • @nicepingrace
    @nicepingrace Před 6 měsíci +2

    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
      @nirlichtman  Před 6 měsíci

      Thanks! Could you elaborate? I don't really understand, what algorithm are you talking about?

    • @nicepingrace
      @nicepingrace Před 6 měsíci

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

  • @niki7968
    @niki7968 Před 6 měsíci

    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

  • @FaranAiki
    @FaranAiki Před 6 měsíci +1

    The dwm font is... uh... how do I put it 😅
    Btw, nice video

  • @adderek
    @adderek Před 6 měsíci

    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.

  • @akinevz_
    @akinevz_ Před 6 měsíci

    Have you considered writing a Rust series? Perhaps one to focus on cross compilation and resolving various toolchain errors?

    • @akinevz_
      @akinevz_ Před 6 měsíci

      Or potentially may we have a series on doing what Rust does in C land? Batch script creation and filesystem watching+toolchain automation?

    • @nirlichtman
      @nirlichtman  Před 6 měsíci

      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?

    • @akinevz_
      @akinevz_ Před 6 měsíci

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

    • @akinevz_
      @akinevz_ Před 6 měsíci

      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

    • @akinevz_
      @akinevz_ Před 6 měsíci

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

  • @mohsenalbo5533
    @mohsenalbo5533 Před 6 měsíci

    Bro you are the reason I'm ditching JavaScript in favorite of C, also what are your thoughts on zig as a replacement?

    • @nirlichtman
      @nirlichtman  Před 6 měsíci +1

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

  • @haslanhaslan
    @haslanhaslan Před 2 měsíci

    You have great videos. Is there a quick way to send and run a parameter to a function in a DLL?

    • @nirlichtman
      @nirlichtman  Před 2 měsíci

      You mean call a function from a DLL? Check out the rundll32 utility built in Windows

    • @haslanhaslan
      @haslanhaslan Před 2 měsíci

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

    • @nirlichtman
      @nirlichtman  Před 2 měsíci +1

      @@haslanhaslan yah i will have a more detailed dll vid in the future, about .so i have a vid on that :)

  • @NullCyan
    @NullCyan Před 6 měsíci +2

    what is the advantage of using DLL over static linking?

    • @nirlichtman
      @nirlichtman  Před 6 měsíci +4

      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

    • @NullCyan
      @NullCyan Před 6 měsíci

      @@nirlichtman thank you so much

  • @kinershah464
    @kinershah464 Před měsícem

    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?

    • @SirusStarTV
      @SirusStarTV Před 9 dny +1

      /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.

    • @kinershah464
      @kinershah464 Před 9 dny +1

      @@SirusStarTV Thanks for the info.

  • @FelipeMendez
    @FelipeMendez Před 6 měsíci

    what window manager are you using?

    • @nirlichtman
      @nirlichtman  Před 6 měsíci

      I am using a port of Suckless dwm for Windows called dwm-win32

  • @ajeetstationajeet
    @ajeetstationajeet Před 6 měsíci +2

    Try to make donut visualisation in c

  • @shad578
    @shad578 Před 4 měsíci

    We really need to use the x64 native tools or no?

    • @SirusStarTV
      @SirusStarTV Před 9 dny

      If you want all the ms dev tools to be callable from terminal then yes

    • @shad578
      @shad578 Před 9 dny

      @@SirusStarTV ok

  • @androth1502
    @androth1502 Před 6 měsíci

    running windows apps in a linux window manager?

    • @nirlichtman
      @nirlichtman  Před 6 měsíci

      I am using Windows, check out my welcome link in the channel desc for my setup info.

    • @androth1502
      @androth1502 Před 6 měsíci

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

  • @fargoth391
    @fargoth391 Před 7 dny

    Why does it sound like you're slamming a hammer on your keyboard every time you press space?

  • @sir890
    @sir890 Před 6 měsíci

    why dont you use IDE for development ?

    • @nirlichtman
      @nirlichtman  Před 6 měsíci +2

      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.

  • @dariokartal9453
    @dariokartal9453 Před 6 měsíci +2

    The loudness of your keypresses is ridiculously high. Why would you wanna distract your viewers like that...

  • @TweetyBlu
    @TweetyBlu Před 6 měsíci

    The sound of mechanical keyboard is extremely annoying.

  • @damnstupidoldidiot8776
    @damnstupidoldidiot8776 Před 6 měsíci

    I use link /dll, is cl /ld better?

  • @Tech.Library
    @Tech.Library Před 6 měsíci

    What is this dll all about? is it like a dependency?

    • @nirlichtman
      @nirlichtman  Před 6 měsíci +2

      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.