Specifies the file format filters to be loaded.


#include "l_bitmap.h"

L_LTFIL_API L_INT L_PreLoadFilters(nFixedFilters, nCachedFilters, pszFilters)


L_INT nFixedFilters

Number of filters that should stay loaded in memory at all times.

L_INT nCachedFilters

Number of filters that should be loaded, but can be unloaded later to make room for other filters.

L_TCHAR* pszFilters

Character string containing the filters which should be loaded. If pszFilters is NULL, all file filters LEADTOOLS can find will be loaded and LEADTOOLS will determine the order in which the files will be used. pszFilters is in the form xyz, where XYZ are the 3-8 letters describing the file filter, for example, LfJ2kx has the following DLL names: LfJ2kx.dll or LfJ2ku.dll. Note that the last 'x' in LfJ2kx.dll identifies the 64-bit version of the DLL, so it is not part of the filter name.

For instance, if pszFilter is "PCX,TIF,CMP" then LFPCXu.dll will be loaded then LFTIFu.dll and then LFCMPu.dll will be loaded. The first nFixedFilters will stay in memory at all times, then the next nCachedFilters will be loaded. However, if other filters will be needed, the cached filters might be unloaded to make room for the new DLLs. It is recommended that the most commonly used DLLs be loaded as fixed to minimize the time required to load/unload file filters. Also, some DLLs may require additional DLLs (like the LFFPXu.dll) so the exact number of DLLs loaded is not necessarily nFixedFilters + nCachedFilters. For more information on available DLLs, refer to Files To Be Included With Your Application.


Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


Some operating systems (like Windows 95) have a limit for the number of DLLs that can be loaded at a time and that limit can be quickly reached, especially if there are several other third party libraries loading DLLs, or if the programming environments themselves load many DLLs. You can use this function to restrict the number of file import/export DLLs that LEADTOOLS will load. Note that the fewer DLLs loaded, the slower the loading/saving of files will be, since there will be more loading/unloading of DLLs.

Please note that L_PreLoadFilters has effect only if called before the first time you try to load, save or get information about a file. If you try to load, save or get information about a file without calling L_PreLoadFilters first, LEAD loads default filters. For more information, refer to Loading File Filters.

If the previously loaded DLLs should be changed, call the L_GetPreLoadFilters function before calling this function.

Required DLLs and Libraries


Win32, x64, Linux.

See Also




This example preloads the BMP, PCX, and TIFF filters, and allows 1 filter to be cached, while always keeping 2 loaded.

L_INT PreLoadFiltersExample(L_VOID) 
   L_INT nRet; 
   nRet = L_PreLoadFilters( 2, 1, TEXT("BMP,PCX,TIF")); 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.