[llvm-commits] [llvm] r137791 - in /llvm/trunk: include/llvm/Support/DynamicLibrary.h lib/Support/DynamicLibrary.cpp lib/Support/Windows/DynamicLibrary.inc

Jordy Rose jediknil at belkadan.com
Tue Aug 16 18:00:37 PDT 2011


Thanks...I don't have a Windows box to test on and made the edits blind. I know that's not a great idea... >_<


On Aug 16, 2011, at 17:57, Francois Pichet wrote:

> hi,
> 
> 2 compile errors on Windows:
> 
> On Tue, Aug 16, 2011 at 8:29 PM, Jordy Rose <jediknil at belkadan.com> wrote:
>> Author: jrose
>> Date: Tue Aug 16 19:29:32 2011
>> New Revision: 137791
>> 
>>  extern "C" {
>> 
>> @@ -63,30 +63,43 @@
>>  #endif
>>         stricmp(ModuleName, "msvcrt20") != 0 &&
>>         stricmp(ModuleName, "msvcrt40") != 0) {
>> -      OpenedHandles.push_back((HMODULE)ModuleBase);
>> +      OpenedHandles->push_back((HMODULE)ModuleBase);
> 
> A DenseSet doesn't have push_back, use insert.
> 
> 
>>     return TRUE;
>>   }
>>  }
>> 
>> -bool DynamicLibrary::LoadLibraryPermanently(const char *filename,
>> -                                            std::string *ErrMsg) {
>> -  if (filename) {
>> -    HMODULE a_handle = LoadLibrary(filename);
>> -
>> -    if (a_handle == 0)
>> -      return MakeErrMsg(ErrMsg, std::string(filename) + ": Can't open : ");
>> -
>> -    OpenedHandles.push_back(a_handle);
>> -  } else {
>> -    // When no file is specified, enumerate all DLLs and EXEs in the
>> -    // process.
>> +DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *filename,
>> +                                                   std::string *errMsg) {
>> +  if (!filename) {
>> +    // When no file is specified, enumerate all DLLs and EXEs in the process.
>> +    SmartScopedLock<true> lock(getMutex());
>> +    if (OpenedHandles == 0)
>> +      OpenedHandles = new DenseSet<HMODULE>();
>> +
>>     EnumerateLoadedModules(GetCurrentProcess(), ELM_Callback, 0);
>> +    // Dummy library that represents "search all handles".
>> +    // This is mostly to ensure that the return value still shows up as "valid".
>> +    return DynamicLibrary(&OpenedHandles);
>> +  }
>> +
>> +  HMODULE a_handle = LoadLibrary(filename);
>> +
>> +  if (a_handle == 0) {
>> +    MakeErrMsg(ErrMsg, std::string(filename) + ": Can't open : ");
> 
> errMsg





More information about the llvm-commits mailing list