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)
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.
There is an excellent article on CodeProject on DLL programming in C++.
I really liked this one on CodeGuru: http://www.codeguru.com/cpp/cpp/cpp_mfc/tutorials/article.php/c9855/DLL-Tutorial-For-Beginners.htm
It's for beginners but it really helped me out.
I can refer you to the following references. See if they are of any use to you.
- C++ DLL Programming
- Assemblies