Results 1 to 3 of 3

Thread: need an explanation about loadlibrary

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    489

    need an explanation about loadlibrary

    what the use of loadlibrary API to load a dll ?
    you declare an API, and it will auto load on runtime,
    what do i need the loadlibrary ?

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: need an explanation about loadlibrary

    Normally, you don't need to use it. Possible reasons to use it, include....

    1. You are going to call the function yourself using Assembly. Very useful if the API is created in a non-VB friendly format (i.e., _CDECL).

    2. You want to test for a specific function within an API, you can load the DLL then call GetProcAddress to see if the function exists.

    3. In some rare cases, you may want to use LoadLibrary to ensure the library is not released by VB before you want it released. By calling LoadLibrary, you create a reference to it and FreeLibrary releases that reference.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    489

    Re: need an explanation about loadlibrary

    Thank you LaVolpe

    I have another question related to that.

    i understood that the declare statement, tells the linker to put
    the dll and other information in the EXE File header,
    and on runtime, Windows loader read that info, and load the dll for me.

    if this is true, i didn't see a declaration for that
    in C,
    i asked in one forum, and they told me, that the linker link me to a Lib
    that load the dll for me

    so, there is no way to tell Windows loader to load dll, in C ?

    or

    there is no such thing, load a dll direct with help of Windows loader ?

    (and in VB the declaration tells the linker to link me to a lib function that will load the dll for me)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width