Forum > General

Is there any reason to NOT always use SafeLoadLibrary instead of LoadLibrary?


In my experience using FPC and Lazarus on 64-Bit Windows, at least, normal LoadLibrary essentially doesn't work at all... it literally fails at least 90% of the time. SafeLoadLibrary, on the other hand, works perfectly 100% of the time. Should I let the results speak for themselves and continue exclusively using SafeLoadLibrary, or are there situations where this specifically isn't a good idea?

safeloadlibrary should only matter for COM libraries

Odd. That's certainly not been the case for me historically...


--- Quote from: marcov on February 19, 2016, 10:15:41 pm ---safeloadlibrary should only matter for COM libraries

--- End quote ---

Well, it should only matter for e.g. ms c/c++ compiled libraries. Some compilers tend to trash the FPU, read: mutilate the FPC control word during loading.
That is really not COM specific although it manifests the problem there more often.
There is no harm in always using safeloadlibrary but is should not be necessary.
Both Delphi and Freepascal won't trash your FPU Control word anyway.


[0] Message Index

Go to full version