diff options
author | Brad King <brad.king@kitware.com> | 2013-11-25 11:19:42 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-11-25 11:19:42 -0500 |
commit | f668112039798f5ebc955e127f9c3e4e7cdb5cc4 (patch) | |
tree | c08b9117d4d6288c7dd34af6cbffd7e0314188a7 /Source/kwsys/DynamicLoader.cxx | |
parent | da6b86f4f031b189768dc474721145a1b99f71ea (diff) | |
parent | 704ab3d24827cfe5754a00028086f21503c2e08b (diff) | |
download | cmake-f668112039798f5ebc955e127f9c3e4e7cdb5cc4.tar.gz |
Merge branch 'upstream-kwsys' into update-kwsys
Diffstat (limited to 'Source/kwsys/DynamicLoader.cxx')
-rw-r--r-- | Source/kwsys/DynamicLoader.cxx | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx index fd83752c00..44cf6af7e8 100644 --- a/Source/kwsys/DynamicLoader.cxx +++ b/Source/kwsys/DynamicLoader.cxx @@ -186,13 +186,12 @@ namespace KWSYS_NAMESPACE DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const char* libname) { DynamicLoader::LibraryHandle lh; -#ifdef UNICODE - wchar_t libn[MB_CUR_MAX]; - mbstowcs(libn, libname, MB_CUR_MAX); - lh = LoadLibrary(libn); -#else - lh = LoadLibrary(libname); -#endif + int length = MultiByteToWideChar(CP_UTF8, 0, libname, -1, NULL, 0); + wchar_t* wchars = new wchar_t[length+1]; + wchars[0] = '\0'; + MultiByteToWideChar(CP_UTF8, 0, libname, -1, wchars, length); + lh = LoadLibraryW(wchars); + delete [] wchars; return lh; } @@ -238,13 +237,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( #else const char *rsym = sym; #endif -#ifdef UNICODE - wchar_t wsym[MB_CUR_MAX]; - mbstowcs(wsym, rsym, MB_CUR_MAX); - result = GetProcAddress(lib, wsym); -#else result = (void*)GetProcAddress(lib, rsym); -#endif #if defined(__BORLANDC__) || defined(__WATCOMC__) delete[] rsym; #endif |