| Programming | Software Engineering | Web Design | Database | Operating Systems

Why LoadLibrary is much slower than GetModuleHandle for dll that is already loaded

Junfeng Zhang
Keywords: LoadLibrary,GetModuleHandle
From: http://blogs.msdn.com/junfeng/archive/2005/03/18/398970.aspx

This question is asked in our internal discussion list. One of the kernel developer answered the question below:

<quote>

LoadLibrary(AlreadyLoadedModule) has to increment the reference count of AlreadyLoadedModule, plus all of that module's dependencies, and their dependencies, recursively.  Since the dependencies are recorded by name, not by a pointer to the loader entry, finding each dependency requires applying the isolation/redirection info in the activation context.  For a module with a lot of imports, or imports which have their own large trees, this makes a LoadLibrary call quite expensive, even if it's already loaded.

GetModuleHandle is a better alternative.

<quote>

This is a FYI post. I won't answer any question.


Related Article
No related article.

Comment
cheap horny goat wweed Post At: 2006-2-2 13:51:14
Hello, it's very good site too: soma on line , club soma http://yakormnevjopu.dynodns.net/soma/soma_on_line.html
purchase ultram online Post At: 2006-2-15 21:36:19
vladgondonpozornii
vicodin valium Post At: 2006-3-9 14:42:34
Very good map: http://watsonalgas.com/map0.html
Add Your Comment:
Your Name:      
Your Comment:
Note: After you post comment,please refresh the browser to show you comment.
Search In YeYan.CN:
 

Home | Privacy Policy | Copyright Policy | Contact Us | Site Map
Copyright © 2006 YeYan.CN, All Rights Reserved.