Announcement

Collapse
No announcement yet.

LoadLibrary-question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • LoadLibrary-question

    If I Use LoadLibrary and GetProcAdress to get the adress of functions in the "MAIN PROGRAM MODULE"
    Then, after using FreeLibrary, will this adresses still be valid ?
    "Sure they will" is an obvious answer, but is that allways true?
    I want to collect som useful codepointers in the calling program
    once when the DLL is initiated.
    and then use this codepointers to generate "events".
    Like progress-report and such things as configuration data.

    -------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se



    [This message has been edited by Fred Oxenby (edited March 28, 2000).]
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

  • #2
    FreeLibrary() decrements the instance count of the target library. Once the count for that library reaches zero, the memory it occupies is freed. I would also add that it is very likely that FreeLibrary() _immediately_ causes the address space occupied by that library to be unmapped from your process address space (even if the library is not unloaded from memory because another process may still be using it), it can no longer be accessed by your process.

    Therefore, once FreeLibrary() has been called, referencing the address space of the library will almost definately earn you a 1 GPF point for trying.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment

    Working...
    X