diff options
author | David Majnemer <david.majnemer@gmail.com> | 2013-10-13 10:34:21 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2013-10-13 10:34:21 +0000 |
commit | 00f31bac0b4013c357f1acf4a696d589ffebcd00 (patch) | |
tree | 169f3c32abbd5522e8247d3b7fd6fbf730e9ecaf /lib/Target/TargetMachineC.cpp | |
parent | 833a29c296da0a6af622448569dcbe01b5cae6c7 (diff) | |
download | external_llvm-00f31bac0b4013c357f1acf4a696d589ffebcd00.zip external_llvm-00f31bac0b4013c357f1acf4a696d589ffebcd00.tar.gz external_llvm-00f31bac0b4013c357f1acf4a696d589ffebcd00.tar.bz2 |
Windows: Use GetModuleHandleEx instead of LoadLibrary
We were using an anti-pattern of:
- LoadLibrary
- GetProcAddress
- FreeLibrary
This is problematic because of several reasons:
- We are holding on to pointers into a library we just unloaded.
- Calling LoadLibrary results in an increase in the reference count of
the library in question and any libraries that it depends on and
so-on and so-forth. This is none too quick.
Instead, use GetModuleHandleEx with GET_MODULE_HANDLE_EX_FLAG_PIN. This
is done because because we didn't bring the reference for the library
into existence and therefor shouldn't count on it being around later.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192550 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetMachineC.cpp')
0 files changed, 0 insertions, 0 deletions