[comctl32/tests #3] Use GetModuleHandleA instead of LoadLibraryA

Paul Vriens paul.vriens.wine at gmail.com
Sun Mar 9 12:12:46 CDT 2008


Mikołaj Zalewski wrote:
>  I've changed GetModuleHandle to LoadLibrary because when I compiled 
> only tests/rebar.c as standalone, the comctl32 wasn't loaded and 
> GetModuleHandle returned NULL. Are there advantages from using 
> GetModuleHandle?
> 
> Mikołaj Zalewski
> 
Well, I was checking whether LoadLibrary was accompanied by a FreeLibrary. In 
this case it wasn't and I thought GetModuleHandle does the trick as well. It did 
for the other stuff in the comctl32 tests.

I'm not in favor of LoadLibrary or GetModuleHandle. I think the general rule 
could be:

If dll is already imported use GetModuleHandle unless compilation excludes the 
dll because there are no reference to the dll.

Does that look a bit sane?

The question that remains is should the full <dll>-tests be able to be compiled 
and run or should we have this to be correct for every single test? I mean that 
are no issues if you compile the whole comctl32 "testsuite".

If LoadLibrary is indeed needed it should be accompanied with a FreeLibrary and 
we probably need a comment for the why as well.

-- 
Cheers,

Paul.



More information about the wine-devel mailing list