Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A request for good tutorials on dll programming [closed]

Tags:

c++

resources

dll

For the past while I've been trying to create plugins for a few applications. These are always dll files and I've followed the instructions in the various app's SDK documentation, but I've never really understood what I was doing. In order to remedy this I've tried to find any resource that deals more with some practical aspects of programming in C++, including dealing with dlls, a list off the top of my head being:

  • dll files, what are they used for and why?
  • why use dll files over libs?
  • what's that .def file all about, is it a microsoft only thing?
  • what is a manifest file for?
  • ...

Basically, all of those lovely options that can be seen in an IDE (Visual Studio and XCxcode for me) - how does one learn what they are and how to use them in conjunction with code slightly more complex than writing a 'hello world' application? I guess I'm looking for a more 'architectural view' on programming. The most I've found so far in all my C++ books is that there's always a section on source code > object code > linked w/ other obj code > executable but that's as far as it goes.

So, are there any good books for someone in my position of wanting to learn more than just C++ syntax? I know about the code, I know about object orientation, I know about the STL. I need a good book or resource for the next step.

Thanks! (and sorry if it's a bit of a vague question, but it has come to this)

like image 631
Anti-Distinctlyminty Avatar asked Sep 27 '12 10:09

Anti-Distinctlyminty


People also ask

What is DLL in programming?

A DLL is a library that contains code and data that can be used by more than one program at the same time. For example, in Windows operating systems, the Comdlg32 DLL performs common dialog box related functions. Each program can use the functionality that is contained in this DLL to implement an Open dialog box.

How can I see what program is using a DLL?

Unzip it and run the executable (procexp.exe) on the target machine as an administrator. Once running, enable viewing of loaded DLLs by either pressing CTRL+D or using the View > Lower Pane View > DLLs entry from the menu bar. Select the target process in the upper pane. The lower pane should now show loaded modules.


1 Answers

dll files, what are they used for and why?

dll files are identical to .exe files on Microsoft Windows (except for 1 bit in the header saying it is a DLL). A dlls memory is shared by any program using it, saving memory. Dlls can be loaded and unloaded from RAM on demand, saving memory. Also they can be updated individually without the need to recompile the .exe (for which you may not have source code available.)

why use dll files over libs?

libs, also known as static libraries, require the exe to be recompiled every time a change is made, Dlls don't. Dlls save memory if multiple processes use them and can be updated for all programs from a centralized location. For libs you would have to recompile and replace every .exe individually. Dlls are extra files that MUST be included with the exe, so dlls can be bad for internet distribution.

what's that .def file all about, is it a microsoft only thing?

A .def is a compiler specific file that tells the compiler how the dll (the API) should be laid out in memory. They can be found in many different compilers including gcc, although supported features and the syntax differ.

what is a manifest file for?

A manifest is new to Windows XP SP3, basically it tells Windows what versions of system libraries that it needs as well as if the binary needs administrator privileges to run. (Remember that a dll is just an exe with one bit different). I believe a manfest is also used in code-signing, verifying if the executable is legitimate.

like image 109
dongle26 Avatar answered Oct 25 '22 18:10

dongle26