Re: Using DLL in a C program
DLL is a library that is particularly being responsible to start the application and linked to the application at that time; unlike a static library included in the program at compile time.
http://en.wikipedia.org/wiki/Linker
API is just a function whose name and arguments and their actions are defined in a document. DLL or static libraries contain an implementation of an API.
A header contains just declarations of functions just to say the compiler that the function exists and take the arguments that calls the functions.
Finally, if you have a sufficient level in English:
http://en.wikipedia.org/wiki/Dynamic-link_library
very complete with full references below.
Re: Using DLL in a C program
Quote:
Originally Posted by
switchblade327
DLL is a library that is particularly being responsible to start the application and linked to the application at that time; unlike a static library included in the program at compile time.
http://en.wikipedia.org/wiki/Linker
It is responsible when the program is needed. It may be long after the program was loaded. This may be long before if another program is needed.
Quote:
Originally Posted by
switchblade327
API is just a function whose name and arguments and their actions are defined in a document. DLL or static libraries contain an implementation of an API.
A Windows API (API for others it may be different) is not a set of functions. It is a function, written in C, included in Windows and documented by Microsoft. The API physically resides in DLLs (user32.dll, for example).
Re: Using DLL in a C program
Quote:
Originally Posted by
Lemog
A Windows API (API for others it may be different) is not a set of functions. It is a function, written in C, included in Windows and documented by Microsoft. The API physically resides in DLLs (user32.dll, for example).
It is a set of things:
- Data structures.
- Functions and procedures.
- Classes and methods.
- Protocols.
And that's not necessarily be written in C, although a prototype could be C which is suitable for linker.
An API can be reduced to a function, but in general this is not the case.
And what about windows, in Wikipedia:
Quote:
An application programming interface (API) is a set of functions, procedures, methods, classes or protocols that an operating system, library or service provides to support requests made by computer programs.
Quote:
The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. It was formerly called the Win32 API; however, the name Windows API more accurately reflects its roots in 16-bit Windows and its support on 64-bit Windows. All Windows programs must interact with the Windows API regardless of the language.
Re: Using DLL in a C program
Thank you for these answers very clear
Also what are the advantages and disadvantages of a DLL loading implicit and explicit loading?
Re: Using DLL in a C program
The difference is that for a load explicit, we must include in the program to call LoadLibrary (), GetProcAddress (), and FreeLibrary () when it is not necessary if the load is implied.
Generally for the DLL that it creates itself, loading is explicit, so we made the three calls the calling program.
With LoadLibrary (), it is certain that the DLL will be charged. This avoids having to ask questions depending on the version of Windows or other parameters. And if we LoadLibrary () when it is not useful, then everything works anyway. But for DLLs hyper Commons, the kind user32.dll is unnecessary to do so.
Often booleans are actually integers. But it would be better if the DLL return the integers.