Static libraries, dynamic libraries, DLLs, entry p

2019-01-23 19:25发布

问题:

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)

回答1:

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.



回答2:

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.



回答3:

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



回答4:

See if these are useful:

  • Static and dynamic libraries
  • Program Library HOWTO