You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by nd...@apache.org on 2003/07/22 22:01:43 UTC

cvs commit: httpd-2.0/modules/generators mod_status.c mod_status.dsp mod_status.h

nd          2003/07/22 13:01:43

  Modified:    modules/generators mod_status.c mod_status.dsp mod_status.h
  Log:
  fix mod_status compilation on Win32 (stolen from mod_dav).
  
  We should consider a rename of AP_*_HOOK_* to CORE_*_HOOK_* ;-)
  
  Revision  Changes    Path
  1.74      +4 -4      httpd-2.0/modules/generators/mod_status.c
  
  Index: mod_status.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_status.c,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- mod_status.c	21 Jul 2003 14:48:02 -0000	1.73
  +++ mod_status.c	22 Jul 2003 20:01:43 -0000	1.74
  @@ -143,10 +143,10 @@
   int server_limit, thread_limit;
   
   /* Implement 'ap_run_status_hook'. */
  -AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(int,status_hook,
  -                                   (request_rec *r, int flags),
  -                                   (r, flags),
  -                                   OK, DECLINED)
  +APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap, STATUS, int, status_hook,
  +                                    (request_rec *r, int flags),
  +                                    (r, flags),
  +                                    OK, DECLINED)
   
   /*
    * command-related code. This is here to prevent use of ExtendedStatus
  
  
  
  1.27      +4 -4      httpd-2.0/modules/generators/mod_status.dsp
  
  Index: mod_status.dsp
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_status.dsp,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- mod_status.dsp	11 Mar 2003 00:58:52 -0000	1.26
  +++ mod_status.dsp	22 Jul 2003 20:01:43 -0000	1.27
  @@ -42,8 +42,8 @@
   # PROP Intermediate_Dir "Release"
   # PROP Ignore_Export_Lib 0
   # PROP Target_Dir ""
  -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
  -# ADD CPP /nologo /MD /W3 /Zi /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Release\mod_status_src" /FD /c
  +# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "STATUS_DECLARE_EXPORT" /FD /c
  +# ADD CPP /nologo /MD /W3 /Zi /O2 /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "STATUS_DECLARE_EXPORT" /Fd"Release\mod_status_src" /FD /c
   # ADD BASE MTL /nologo /D "NDEBUG" /win32
   # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
   # ADD BASE RSC /l 0x409 /d "NDEBUG"
  @@ -68,8 +68,8 @@
   # PROP Intermediate_Dir "Debug"
   # PROP Ignore_Export_Lib 0
   # PROP Target_Dir ""
  -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
  -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /Fd"Debug\mod_status_src" /FD /c
  +# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STATUS_DECLARE_EXPORT" /FD /c
  +# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "../../include" /I "../../srclib/apr/include" /I "../../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "STATUS_DECLARE_EXPORT" /Fd"Debug\mod_status_src" /FD /c
   # ADD BASE MTL /nologo /D "_DEBUG" /win32
   # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
   # ADD BASE RSC /l 0x409 /d "_DEBUG"
  
  
  
  1.2       +20 -2     httpd-2.0/modules/generators/mod_status.h
  
  Index: mod_status.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_status.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mod_status.h	21 Jul 2003 14:48:02 -0000	1.1
  +++ mod_status.h	22 Jul 2003 20:01:43 -0000	1.2
  @@ -62,6 +62,24 @@
   #define AP_STATUS_NOTABLE  (0x2)  /* HTML report without tables */
   #define AP_STATUS_EXTENDED (0x4)  /* detailed report */
   
  +#if !defined(WIN32)
  +#define STATUS_DECLARE(type)            type
  +#define STATUS_DECLARE_NONSTD(type)     type
  +#define STATUS_DECLARE_DATA
  +#elif defined(STATUS_DECLARE_STATIC)
  +#define STATUS_DECLARE(type)            type __stdcall
  +#define STATUS_DECLARE_NONSTD(type)     type
  +#define STATUS_DECLARE_DATA
  +#elif defined(STATUS_DECLARE_EXPORT)
  +#define STATUS_DECLARE(type)            __declspec(dllexport) type __stdcall
  +#define STATUS_DECLARE_NONSTD(type)     __declspec(dllexport) type
  +#define STATUS_DECLARE_DATA             __declspec(dllexport)
  +#else
  +#define STATUS_DECLARE(type)            __declspec(dllimport) type __stdcall
  +#define STATUS_DECLARE_NONSTD(type)     __declspec(dllimport) type
  +#define STATUS_DECLARE_DATA             __declspec(dllimport)
  +#endif
  +
   /* Optional hooks which can insert extra content into the mod_status
    * output.  FLAGS will be set to the bitwise OR of any of the
    * AP_STATUS_* flags.
  @@ -69,6 +87,6 @@
    * Implementations of this hook should generate content using
    * functions in the ap_rputs/ap_rprintf family; each hook should
    * return OK or DECLINED. */
  -AP_DECLARE_HOOK(int, status_hook, (request_rec *r, int flags))
  -
  +APR_DECLARE_EXTERNAL_HOOK(ap, STATUS, int, status_hook,
  +                          (request_rec *r, int flags))
   #endif
  
  
  

Re: cvs commit: httpd-2.0/modules/generators mod_status.c mod_status.dsp mod_status.h

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 08:37 AM 7/24/2003, Joe Orton wrote:
>On Tue, Jul 22, 2003 at 08:01:43PM -0000, nd@apache.org wrote:
>> nd          2003/07/22 13:01:43
>> 
>>   Modified:    modules/generators mod_status.c mod_status.dsp mod_status.h
>>   Log:
>>   fix mod_status compilation on Win32 (stolen from mod_dav).
>>   
>>   We should consider a rename of AP_*_HOOK_* to CORE_*_HOOK_* ;-)
>
>Are these STATUS_DECLARE_* things really needed? 

Even if we use the same 'namespace', e.g. ap_, each DECLARE macro family
applies to just a single loadable module.

When we build that module (all of it's source files) we FOO_DECLARE_EXPORT 
to declare that every symbol of FOO_ is exported.  Otherwise, if you mix and
match source files, you end up with "Exported symbol was imported" sorts of
warning messages.

When we plan to link to the module (which exposes static linkage entry points),
then we provide these macros so the 3rd modules' sources know that the entry
point is imported.

Yah - there are other ways (less clean IMHO) to deal with fn entry points.
However, there is no other way to deal with data declarations.  If you mess
that up, the compiled code is not relocateable, and therefore segfaults if
another module is previously loaded at this module's expected address.

Bill



Re: cvs commit: httpd-2.0/modules/generators mod_status.c mod_status.dsp mod_status.h

Posted by Bill Stoddard <bi...@wstoddard.com>.
André Malo wrote:

> * Joe Orton wrote:
> 
> 
>>On Tue, Jul 22, 2003 at 08:01:43PM -0000, nd@apache.org wrote:
>>
>>>nd          2003/07/22 13:01:43
>>>
>>>  Modified:    modules/generators mod_status.c mod_status.dsp mod_status.h
>>>  Log:
>>>  fix mod_status compilation on Win32 (stolen from mod_dav).
>>>
>>>  We should consider a rename of AP_*_HOOK_* to CORE_*_HOOK_* ;-)
>>
>>Are these STATUS_DECLARE_* things really needed?
> 
> 
> In general - yes. If you'd use AP_DECLARE (as before), VC confuses dllimport
> vs. dllexport. We want to export the function from mod_status.so
> (STATUS_DECLARE_*), but import stuff from core (AP_DECLARE_*). Thatswhy the
> extra namespace.
> 
> We don't need *all* these declarations currently, but perhaps some time in the
> future. Then it will be there and nobody will shoot himself in the foot,
> because of missing declarations.
> 
> (If you have a look into mod_dav or mod_ldap, you'll see the same thing with
> other namespaces, namely DAV and LDAP).

and mod_cache and mod_proxy.

Bill


Re: cvs commit: httpd-2.0/modules/generators mod_status.c mod_status.dsp mod_status.h

Posted by Joe Orton <jo...@redhat.com>.
On Thu, Jul 24, 2003 at 04:27:07PM +0200, André Malo wrote:
> * Joe Orton wrote:
> 
> > On Tue, Jul 22, 2003 at 08:01:43PM -0000, nd@apache.org wrote:
> >> nd          2003/07/22 13:01:43
> >>
> >>   Modified:    modules/generators mod_status.c mod_status.dsp mod_status.h
> >>   Log:
> >>   fix mod_status compilation on Win32 (stolen from mod_dav).
> >>
> >>   We should consider a rename of AP_*_HOOK_* to CORE_*_HOOK_* ;-)
> > 
> > Are these STATUS_DECLARE_* things really needed?
> 
> In general - yes. If you'd use AP_DECLARE (as before), VC confuses dllimport
> vs. dllexport. We want to export the function from mod_status.so
> (STATUS_DECLARE_*), but import stuff from core (AP_DECLARE_*). Thatswhy the
> extra namespace.
> 
> We don't need *all* these declarations currently, but perhaps some time in the
> future. Then it will be there and nobody will shoot himself in the foot,
> because of missing declarations.

OK, thanks.  I understood why STATUS_DECLARE itself was needed, just not
the other two.  Seems a bit redundant to leave them there if they're not
used, but no big deal I suppose.

joe

Re: cvs commit: httpd-2.0/modules/generators mod_status.c mod_status.dsp mod_status.h

Posted by André Malo <nd...@perlig.de>.
* Joe Orton wrote:

> On Tue, Jul 22, 2003 at 08:01:43PM -0000, nd@apache.org wrote:
>> nd          2003/07/22 13:01:43
>>
>>   Modified:    modules/generators mod_status.c mod_status.dsp mod_status.h
>>   Log:
>>   fix mod_status compilation on Win32 (stolen from mod_dav).
>>
>>   We should consider a rename of AP_*_HOOK_* to CORE_*_HOOK_* ;-)
> 
> Are these STATUS_DECLARE_* things really needed?

In general - yes. If you'd use AP_DECLARE (as before), VC confuses dllimport
vs. dllexport. We want to export the function from mod_status.so
(STATUS_DECLARE_*), but import stuff from core (AP_DECLARE_*). Thatswhy the
extra namespace.

We don't need *all* these declarations currently, but perhaps some time in the
future. Then it will be there and nobody will shoot himself in the foot,
because of missing declarations.

(If you have a look into mod_dav or mod_ldap, you'll see the same thing with
other namespaces, namely DAV and LDAP).

nd

Re: cvs commit: httpd-2.0/modules/generators mod_status.c mod_status.dsp mod_status.h

Posted by Joe Orton <jo...@redhat.com>.
On Tue, Jul 22, 2003 at 08:01:43PM -0000, nd@apache.org wrote:
> nd          2003/07/22 13:01:43
> 
>   Modified:    modules/generators mod_status.c mod_status.dsp mod_status.h
>   Log:
>   fix mod_status compilation on Win32 (stolen from mod_dav).
>   
>   We should consider a rename of AP_*_HOOK_* to CORE_*_HOOK_* ;-)

Are these STATUS_DECLARE_* things really needed? 

>   +#if !defined(WIN32)
>   +#define STATUS_DECLARE(type)            type
>   +#define STATUS_DECLARE_NONSTD(type)     type
>   +#define STATUS_DECLARE_DATA
>   +#elif defined(STATUS_DECLARE_STATIC)
>   +#define STATUS_DECLARE(type)            type __stdcall
>   +#define STATUS_DECLARE_NONSTD(type)     type
>   +#define STATUS_DECLARE_DATA
>   +#elif defined(STATUS_DECLARE_EXPORT)
>   +#define STATUS_DECLARE(type)            __declspec(dllexport) type __stdcall
>   +#define STATUS_DECLARE_NONSTD(type)     __declspec(dllexport) type
>   +#define STATUS_DECLARE_DATA             __declspec(dllexport)
>   +#else
>   +#define STATUS_DECLARE(type)            __declspec(dllimport) type __stdcall
>   +#define STATUS_DECLARE_NONSTD(type)     __declspec(dllimport) type
>   +#define STATUS_DECLARE_DATA             __declspec(dllimport)
>   +#endif
>   +