You have a lot of questions here, but I'm going to try and answer a few of them.
One of the first ones you should learn is how DLLs work.
A DLL is a "dynamically linked library". Normally when you compile, you create an executable. That is a file which can be executed by the OS through a single entry point (usually)
int main(int argc, char* argv[])
. Now you may have a generic piece of code which is designed for use by multiple executables (like DirectX), or perhaps is designed as an extension to an existing executable. The first case is easier to describe. In this case you are providing a binary (just like an exe), but it isn't designed to be called by the OS when someone double-clicks on the icon. It's designed to be called by an existing process. It can provide an interface with more than just
int main()
. You could write a few functions, call it "novellofGenericFunctions.dll", compile it, and make it available to every one of the applications you ever write from now to the end of time.
The user would then include the appropriate header, and tell the linker that these functions exist in a DLL to be loaded at runtime.
How is DirectX made?
I understand that you want to do everything from scratch, and that's cool, but at some point you'll want to use a 3rd party lib for some things and here's why. DirectX and OpenGL are very low-level libraries. They provide a C-API which allows you to use the provided functions in the DirectX DLLs to call code which actually packs processor op-codes and sends them to the appropriate video-card on the AGP, PCI or PCI-express bus. If you wanted to do this yourself, you'd need to get documentation from your video-card vendor about the opcodes and interface that card uses. Then you'd need to provide functions to the rest of your program to provide a simpler interface to perform the required actions. Now you're really getting hardware specific. Just to give you an idea of how complicated this is: hardware providers (ATI, Nvidia) build video cards to be compatible with DirectX/OpenGL. Software developers do not modify DirectX/OpenGL to be compatible with different video cards.
Note, at some point you will certainly need a 3rd party library, otherwise you'd need to even write your own OS. At the bottom of it all, you have calls to the operating system's libraries. If you want to get as low as you can without re-writing an OS, check out this tutorial:
http://www.winprog.org/tutorial/
It shows you how to create a windowed application using only the Windows API (the low-level C API, not the high-level C# stuff). If you want to go deeper than that, you'll want to move to Linux where you can see the sources of what is deeper (like xlib) and decide whether to write your own.