Afxloadlibrary vs loadlibrary

Source: Internet
Author: User
For afxloadlibrary, and serving as the DLL Search Rule: when no path is specified, the function searches for the file in the following sequence:
  • The directory from which the application loaded.

  • The current directory.

  • Windows 95/98:The Windows System directory.Windows NT:The 32-bit Windows System directory. The name of this directory is system32.

  • Windows NT only:The 16-bit Windows System directory. There is no Win32 function that obtains the path of this directory, but it is searched. The name of this directory is system.

  • The Windows directory.

  • The directories that are listed in the PATH environment variable.

Each process maintains a reference count for each loaded library module. This reference count is incremented each timeAfxloadlibraryIs called and is decremented each timeAfxfreelibraryIs called. When the reference count reaches zero, the module is unmapped from the address space of the calling process and the handle is no longer valid.

Be sure to useAfxloadlibraryAndAfxfreelibrary(Instead of the Win32 FunctionsLoadlibraryAndFreelibrary) If your application uses multiple threads and if it dynamically loads an extension DLL. UsingAfxloadlibraryAndAfxfreelibraryInsures that the startup and shutdown code that executes when the extension DLL is loaded and unloaded does not necessarily upt the global MFC state.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.