dvdsum a écrit :
> Hello, my english is very poor, excuse me. I want that someone explains
> several things.
> Ok,
>
> Windows, as well as other modern operating systems, gives a set of
> functions called API. The programmer can access to the functionalities
> of the system by them. Is it right? The functions are grouped, for
> example kernel and user. Now, in a compiler as gcc what does
> libkernel32.a represent? The dll are written in C and then why do we
> use libkernel32.a and not kernel.dll?
> What are files lib*.a? Thank you very much!
>
> Bye
>
> dvddum
>
Compiled functions are grouped in files called "libraries". Those files
contain several compiled functions that perform various functions like
drawing a line, opening a file, making coffee, etc.
Libraries are normally called file.lib under windows, or libfile.a under
Unix. Since gcc comes from Unix, it names its libraries .a instead of
..lib.
Libraries can come in two "flavors". Normal "static" libraries, that
contain the code of the functions, and "import" libraries that are
just stubs that tell the dynamic linker/loader where those functions
are actually defined. When you use a dll (or a shared object using Unix
naming conventions) your libraries allows your executable to be
associated to a dynamic library (a .dll under windows a .so under
Unix). In your example libkernel32.a just associates some of
the functions that you use in your program with kernel32.dll.
Under windows you can use the dll directly (without linking to it) by
using the LoadLibrary API. Under Unix you use dlopen() or similar
functions. Note that you must link the dll that contains the
LoadLibrary API STATICALLY, you can't load kernel32.dll dynamically
since it containes the LoadLibrary API. In the same manner
it doesn't make sense to load the library that contains dlopen()
using dlopen()