Recent

Author Topic: Is there any reason to NOT always use SafeLoadLibrary instead of LoadLibrary?  (Read 4297 times)

Akira1364

  • Hero Member
  • *****
  • Posts: 561
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?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
safeloadlibrary should only matter for COM libraries

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Odd. That's certainly not been the case for me historically...

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
safeloadlibrary should only matter for COM libraries

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.
« Last Edit: February 22, 2016, 05:10:31 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018