Results 1 to 6 of 6

Thread: Using DLL in a C program

  1. #1
    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!

  2. #2
    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.

  3. #3
    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).

  4. #4
    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:

    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.
    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.

  5. #5
    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?

  6. #6
    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.

Similar Threads

  1. Windows 7: Program Files vs Program Files(x86)
    By Script in forum Operating Systems
    Replies: 5
    Last Post: 01-06-2011, 06:03 PM
  2. Replies: 3
    Last Post: 28-01-2011, 01:57 PM
  3. Windows DEP program continuously closes the MSN mail program
    By Charioteer in forum Windows Software
    Replies: 4
    Last Post: 19-10-2010, 11:52 AM
  4. Running a program under WOW64 on a program X64
    By Pratyush in forum Software Development
    Replies: 2
    Last Post: 08-04-2009, 09:51 PM
  5. End Program ccSvcHst Program not responding
    By Leena in forum Operating Systems
    Replies: 6
    Last Post: 29-08-2008, 01:58 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,719,693.15877 seconds with 17 queries