I know Visual Studio comes with the projects, but I was wondering how you could create them by hand. I know the difference is a DLL can be swapped out after the program has been compiled, and the static cannot, but what is the difference in coding them? How do you code them?
Does creating one of these libraries remove the requirement to link all of the .cpp files required to compile a regular file? For example, with my main.cpp, I have to include header.cpp to have all of my special, non standard, functions defined. Is there a way I can just type
g++ main.cpp -o main.exe
Edit: A tutorial would be great, but even googling it only returns VS projects and C++ Builder, neither of which I want to use, unless I absolutely have to.
Thanks, but I found those tutorials already. I'm looking for something that will teach me how to make libraries without using MSVS10 or C++ Builder. I've seen that g++ has options to build libraries, but the only information that I found about it is that it's physically able to compile libraries. What does my code need to look like in order to create the library? What does my command line call have to look like to create it?
Code::Blocks has a project template to create a library. Just use it and enable "display full command line" option to be able to reproduce it without using any IDE.
A library is just a regular compilation without any entry point defined, a collection of functions compiled to object code.
So in the library I would just include the header file that contains my function prototypes and my .cpp that contains my definitions? I don't need to right them a specific way? How do I end up calling the libraries then?
To further use that library in another projects just include header file with functions definitions and pass the library file itself to the linker (usually .a or .lib file). No need for any .cpp file.
I'm going to have to fiddle with it a little later, and maybe if I feel confident enough, maybe I'll try to get a how to typed up. Could be nice to have a reference for others as I didn't quite see anything about making a library through the command line.
Neither of these showed up in my google searches. Granted, I only check 30 results from google before I changed my search, but that's a lot for me when googling.
Thanks for the finds and I'll have a read through both of these once I'm done working for the day.