Announcement

Collapse
No announcement yet.

Is FreeLibrary different in WinXp and Win98?

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

  • Michael Mattias
    replied
    > Freelibrary......
    >I checked the %DLL_THREAD_ATTACH inside the Dll.

    ???

    On freelibrary you should get a DLL_THREAD_DETACH as well as a DLL_PROCESS_DETACH, not "attach" notifications.

    Leave a comment:


  • Heinz Grandjean
    replied
    Thanks very much for Your help!

    Interestingly in Win98 after recieving zero for the return-value of FreeLibrary the return-value of the immediate following GetLastError is also zero.
    To sum it up, it works now relieable, but honestly I don't know exactly why
    Thanks again
    Heinz Grandjean

    Leave a comment:


  • Cliff Nichols
    replied
    To my knowledge
    >FreeLibrary h_MyDll to lResult will always result in 0
    I could be wrong

    I took things a step farther, but less sure of it
    do
    FreeLibrary h_MyDll to h_MyDll
    Loop until h_MyDll = 0

    but its a thought

    Leave a comment:


  • Michael Mattias
    replied
    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    That is, the value is immaterial.

    But it's failing on Win/98... you can get the error info by calling GetLastError
    Code:
    ...
    lResult  = FreeLibrary (h_MyDLL) 
    LE        = getLastError ()
    IF ISFALSE lResult THEN 
       Output "FreeLibrary failed with system error code " & FORMAT$(LE) 
    ...
    FormatMessage can be used to convert LE to text:
    Code:
    FUNCTION SystemErrorMessageText (BYVAL ECode AS LONG) AS STRING
      LOCAL Buffer AS ASCIIZ * 255
      FormatMessage %FORMAT_MESSAGE_FROM_SYSTEM, BYVAL %NULL, ECode, %NULL, buffer, SIZEOF(buffer), BYVAL %NULL
      FUNCTION = FORMAT$(ECode, "##### ") & Buffer
    END FUNCTION
    MCM

    Leave a comment:


  • Heinz Grandjean
    started a topic Is FreeLibrary different in WinXp and Win98?

    Is FreeLibrary different in WinXp and Win98?

    Hello PB-Community!

    I'm struggling with a problem concerning runtime-linking to a DLL.

    Code: FreeLibrary h_MyDll to lResult

    In WinXp lResult is > 0. So far OK.
    In Win98 I get always lResult = 0.
    I checked the %DLL_THREAD_ATTACH inside the Dll.
    It's always called correctly in both cases.

    Thanks for any help,

    Heinz Grandjean
Working...
X