views:

803

answers:

4

Hello, I recently had to program C++ under Windows for an University project, and I'm pretty confused about static and dynamic libraries system, what the compiler needs, what the linker needs, how to build a library ... is there any good document about this out there? I'm pretty confused about the *nix library system as well (so, dylibs, the ar tool, how to compile them ...), can you point a review document about the current library techniques on the various architectures?

Note: due to my poor knowledge this message could contain wrong concepts, feel free to edit it.

Thank you

Feel free to add more reference, I will add them to the summary.


References

Since most of you posted *nix or Windows specific references I will summarize here the best ones, I will mark as accepted answer the Wikipedia one, because is a good start point (and has references inside too) to get introduced to this stuff.

Program Library Howto (Unix)

Dynamic-Link Libraries (from MSDN) (Windows)

DLL Information (StackOverflow) (Windows)

Programming in C (Unix)

An Overview of Compiling and Linking (Windows)

+2  A: 

Start with Wikipedia - plenty of information there, and lots of links to other useful resources.

P.S. But perhaps it would be better to just ask a specific question about the problem you're currently having. Learning how to solve it may go a long way to teaching you the general concepts.

Eli Bendersky
I don't have a real problem now, just wanted to know more about how libraries work under the various systems and how to create them.
tunnuz
Wikipedia as a teaching tool. I think you can do better.Try these books:Expert C Programming by Peter van der LindenInside the C++ Object Model by Stanley B. LippmanRuminations on C++: A Decade of Programming Insight and Experience by Andrew KoenigAnd finally and more specifically for your immediate needs:http://www.amazon.com/Windows-via-C-Pro-Developer/dp/0735624240/ref=pd_rhf_shvl_3
MaSuGaNa
MaSuGaNa - I'm sure that a 2-3 hour look at the Wikipedia page and the articles it's pointing to is more like what the OP had in mind, surely than reading 4 large books of which only small parts deal with what he asked about - and you didn't even indicate which parts
Eli Bendersky
+1  A: 

There is always MSDN for windows related stuff: Head page for dlls -> http://msdn.microsoft.com/en-us/library/ms682589

For Unix my favorite reference manual: Programming in C, UNIX System Calls and Subroutines using C -> http://www.cs.cf.ac.uk/Dave/C/

RM

Roman M
+2  A: 

You can find some background information from this article here. It gives you the basic background. I'm trying to locate something with diagrams. This should be a good place to get started.

The fundamental differences between a static library and a DLL is that with the static library the code is compiled into your final executable whereas a dynamic link library involves linking in a "stub" library (into your application) which contains mappings to functions in a separate file (.dll).

Here's an MSDN entry on creating a static Win32 Library which might also help you. ..another link to MSDN for creating a Dynamic Link Library..

Just found this site which covers definitions of basically all the aspect you've quoted.

RobS