apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r743703 - /apr/apr/trunk/include/arch/win32/apr_arch_misc.h
Date Thu, 12 Feb 2009 12:38:03 GMT
Author: mturk
Date: Thu Feb 12 12:38:02 2009
New Revision: 743703

URL: http://svn.apache.org/viewvc?rev=743703&view=rev
Log:
Extend DLL late load macros to include function presence check.

Modified:
    apr/apr/trunk/include/arch/win32/apr_arch_misc.h

Modified: apr/apr/trunk/include/arch/win32/apr_arch_misc.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/win32/apr_arch_misc.h?rev=743703&r1=743702&r2=743703&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/win32/apr_arch_misc.h (original)
+++ apr/apr/trunk/include/arch/win32/apr_arch_misc.h Thu Feb 12 12:38:02 2009
@@ -184,18 +184,24 @@
 /* The apr_load_dll_func call WILL return 0 set error to
  * ERROR_INVALID_FUNCTION if the function cannot be loaded
  */
-
 #define APR_DECLARE_LATE_DLL_FUNC(lib, rettype, calltype, fn, ord, args, names) \
     typedef rettype (calltype *apr_winapi_fpt_##fn) args; \
     static apr_winapi_fpt_##fn apr_winapi_pfn_##fn = NULL; \
-    static APR_INLINE rettype apr_winapi_##fn args \
-    {   if (!apr_winapi_pfn_##fn) \
+    static int apr_winapi_chk_##fn = 0; \
+    static APR_INLINE int apr_winapi_ld_##fn() \
+    {   if (apr_winapi_pfn_##fn) return 1; \
+        if (apr_winapi_chk_##fn ++) return 0; \
+        if (!apr_winapi_pfn_##fn) \
             apr_winapi_pfn_##fn = (apr_winapi_fpt_##fn) \
                                       apr_load_dll_func(lib, #fn, ord); \
-        if (apr_winapi_pfn_##fn) \
+        if (apr_winapi_pfn_##fn) return 1; else return 0; }; \
+    static APR_INLINE rettype apr_winapi_##fn args \
+    {   if (apr_winapi_ld_##fn()) \
             return (*(apr_winapi_pfn_##fn)) names; \
         else { SetLastError(ERROR_INVALID_FUNCTION); return 0;} }; \
 
+#define APR_HAVE_LATE_DLL_FUNC(fn) apr_winapi_ld_##fn()
+
 /* Provide late bound declarations of every API function missing from
  * one or more supported releases of the Win32 API
  *



Mime
View raw message