From 7c841c6bb29677c9418a9dd2cede1a47e2a4ee5b Mon Sep 17 00:00:00 2001 From: Jeff Genovy <29107334+jefgen@users.noreply.github.com> Date: Fri, 21 Jul 2017 00:48:43 +0000 Subject: [PATCH] ICU-13278 Fix ifdefs for U_ENABLE_DYLOAD for Windows and UWP. X-SVN-Rev: 40281 --- icu4c/source/common/putil.cpp | 48 +++++------------------------------ 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/icu4c/source/common/putil.cpp b/icu4c/source/common/putil.cpp index 6290b63cd5f..96f343635a7 100644 --- a/icu4c/source/common/putil.cpp +++ b/icu4c/source/common/putil.cpp @@ -2333,19 +2333,16 @@ u_getVersion(UVersionInfo versionArray) { * icucfg.h dependent code */ -#if U_ENABLE_DYLOAD - -#if HAVE_DLOPEN && !U_PLATFORM_USES_ONLY_WIN32_API +#if U_ENABLE_DYLOAD && HAVE_DLOPEN && !U_PLATFORM_USES_ONLY_WIN32_API #if HAVE_DLFCN_H - #ifdef __MVS__ #ifndef __SUSV3 #define __SUSV3 1 #endif #endif #include -#endif +#endif /* HAVE_DLFCN_H */ U_INTERNAL void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status) { @@ -2385,38 +2382,10 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { return uret.fp; } -#else +#elif U_ENABLE_DYLOAD && U_PLATFORM_USES_ONLY_WIN32_API && !U_PLATFORM_HAS_WINUWP_API -/* null (nonexistent) implementation. */ - -U_INTERNAL void * U_EXPORT2 -uprv_dl_open(const char *libName, UErrorCode *status) { - if(U_FAILURE(*status)) return NULL; - *status = U_UNSUPPORTED_ERROR; - return NULL; -} - -U_INTERNAL void U_EXPORT2 -uprv_dl_close(void *lib, UErrorCode *status) { - if(U_FAILURE(*status)) return; - *status = U_UNSUPPORTED_ERROR; - return; -} - - -U_INTERNAL UVoidFunction* U_EXPORT2 -uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { - if(U_SUCCESS(*status)) { - *status = U_UNSUPPORTED_ERROR; - } - return (UVoidFunction*)NULL; -} - - - -#endif - -#elif U_PLATFORM_USES_ONLY_WIN32_API +/* Windows API implementation. */ +// Note: UWP does not expose/allow these APIs, so the UWP version gets the null implementation. */ U_INTERNAL void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status) { @@ -2443,7 +2412,6 @@ uprv_dl_close(void *lib, UErrorCode *status) { return; } - U_INTERNAL UVoidFunction* U_EXPORT2 uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { HMODULE handle = (HMODULE)lib; @@ -2465,10 +2433,9 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { return addr; } - #else -/* No dynamic loading set. */ +/* No dynamic loading, null (nonexistent) implementation. */ U_INTERNAL void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status) { @@ -2486,7 +2453,6 @@ uprv_dl_close(void *lib, UErrorCode *status) { return; } - U_INTERNAL UVoidFunction* U_EXPORT2 uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { (void)lib; @@ -2497,7 +2463,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { return (UVoidFunction*)NULL; } -#endif /* U_ENABLE_DYLOAD */ +#endif /* * Hey, Emacs, please set the following: