Header/Static Lib/Dynamic Lib Dilemma

Hello Everyone!

It's about time I started a fresh thread about this, it's been troubling me. Can someone help me out with the following:

1
2
3
#include <iostream>
#include <windows.h>
#include <wininet.h> 


Link with libwininet.a

No, the WinAPI consists of many different DLLs. See one of my previous posts.
WinAPI libraries are always linked dynamically, static linking isn't possible here.
This is something Athar mentioned in a previous post of mine.

My questions are:

(0) What are .a libraries and .lib libraries?
(1) WinAPI is, sluggishly put, a part of windows.h? How come its supported libraries are dynamically linked, while, the libraries of wininet.h are statically linked, while, the libraries of iostream are not even mentioned?!


(0) What are .a libraries and .lib libraries?

Static libraries or import libraries (to link to DLLs).

WinAPI is, sluggishly put, a part of windows.h?

Rather the other way round. windows.h includes a lot of the WinAPI headers (but not all).

How come its supported libraries are dynamically linked, while, the libraries of wininet.h are statically linked

Huh? wininet.dll is part of the WinAPI. It's dynamically linked, like everything else.
See here for a list: http://msdn.microsoft.com/en-us/library/ff818516.aspx

the libraries of iostream are not even mentioned?!

iostream is not part of the WinAPI. It's part of the C++ standard library.
I'm not referring to iostream as a part of winapi! I am asking, why do I need to include wininet.h AND choose my linker to link with libwininet.a, while I can only include iostream and not worry about linking other libraries?
Ah. That's because the C++ standard library is one of the libraries that is automatically linked.
If you search in your MinGW install path, you'll find a libstdc++.a somewhere. iostream is part of that.
@Athar

Could you suggest a reading that would clear all the ambiguity I have about this issue. Clearly I need examples and what not.

Thanks!
Topic archived. No new replies allowed.