Dynamic and Static Libraries in C++ -
In my quest to learn C ++, I have come into dynamic and static libraries.
I usually get it
However, I want to know some things about them:
- Write them to the normal C ++ program , Minus
main ()
function? - How does the compiled program get a library? This is clearly not executable, so how can I say 'test.cpp' in 'test.dll'?
- Once I get it in my form, how do I include it in any other program?
- Is there a standard place to keep them, so that whatever compilers / linkers are required, find them easily?
- What is the difference between a dynamic and stable library (technically and practically)?
- How do I use third party libraries in my code (I see
.dylib
and.a
files for MySQL C ++ connector
I am getting all things related to libraries that are targeting people who already know how to use them. I, however, do not (but would like!)
Thank you!
(I should also note that I am using Mac OS X, and although it likes to be IDE-neutral or command-line oriented, I have no other than a normal C ++ program Also writing, I use QtCure / Netbeans)
Zero to main ( ) Function?
No.
How does the compiled program get a library? This is clearly not executable, so how do I say 'test.cpp' in 'test.dll'?
When you're compiling the -dynamiclib
flag (the result name is still by default a.out
On Mac OS X, you get your dynamic libraries as lib ***. Dylib
, and on Linux, lib ***. Therefore
(shared objects) < / P>
Once I get it in my format, how do I include it in another program?
First, create an header file so that other programs #include
know which work you used in your deliberation can go.
Second, link to your dialyee if your Deal is named libblah.dylib
, then you pass the GCC to -lblah
flag.
Is there a standard place, so that any compiler / linker is required to get it easily?
/ usr / lib
or / usr / local / lib
.
What is the difference between the dynamic and static library (technically and practically)?
Basically, for a static lib, it is embedded in "link" in the entire library file.
How do I use third party libraries in my code (I am moving on .dylib and .a files for the MySQL C ++ connector)
See the third answer.
Comments
Post a Comment