Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Using DLL in a C program

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 06-12-2008
Member
 
Join Date: Nov 2008
Posts: 1,259
Using DLL in a C program
  

I am trying to use a DLL in a C program, provided for the use of a specific material, not very developed on this subject. I searched a lot for it in Google whether this is possible but didn't found anything. I tried to make an example for this but because of the lack of basic knowledge, I was unable to do so.

BTW: what is a DLL? what are the similarities and differences with an API?

Need your help!

Reply With Quote
  #2  
Old 06-12-2008
Member
 
Join Date: May 2008
Posts: 3,971
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.
Reply With Quote
  #3  
Old 06-12-2008
Member
 
Join Date: May 2008
Posts: 945
Re: Using DLL in a C program

Quote:
Originally Posted by switchblade327 View Post
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 View Post
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).
Reply With Quote
  #4  
Old 06-12-2008
Member
 
Join Date: Feb 2008
Posts: 194
Re: Using DLL in a C program

Quote:
Originally Posted by Lemog View Post
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.
Reply With Quote
  #5  
Old 06-12-2008
Member
 
Join Date: Nov 2008
Posts: 1,259
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?
Reply With Quote
  #6  
Old 06-12-2008
Member
 
Join Date: May 2008
Posts: 945
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Using DLL in a C program"
Thread Thread Starter Forum Replies Last Post
Windows 7: Program Files vs Program Files(x86) Script Operating Systems 5 01-06-2011 06:03 PM
“This program is using by another program” error message in windows 7 SchuRacer Operating Systems 3 28-01-2011 12:57 PM
Windows DEP program continuously closes the MSN mail program Charioteer Windows Software 4 19-10-2010 11:52 AM
Running a program under WOW64 on a program X64 Pratyush Software Development 2 08-04-2009 09:51 PM
End Program ccSvcHst Program not responding Leena Operating Systems 6 29-08-2008 01:58 PM


All times are GMT +5.5. The time now is 09:31 PM.