RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
SysUtils.SafeLoadLibrary Function

Safe and simple library loading.

Pascal
function SafeLoadLibrary(const FileName: string; ErrorMode: UINT = SEM_NOOPENFILEERRORBOX): HMODULE;
C++
HMODULE SafeLoadLibrary(const AnsiString FileName, UINT ErrorMode = SEM_NOOPENFILEERRORBOX);

SysUtils

SafeLoadLibrary loads a Windows DLL or Linux shared object file, as specified by Filename. SafeLoadLibrary preserves the current FPU control word, preventing library initialization code from permanently overwriting precision and exception masks.

Note: On Windows, SafeLoadLibrary temporarily sets the system error mode to ErrorMode. The default, SEM_NOOPENFILEERRORBOX, suppresses error dialogs. The previous error mode is restored before SafeLoadLibrary exits. For a list of error modes, refer to SetErrorMode in the Microsoft documentation.
Note: On Linux, the Dummy argument is ignored.
 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!