You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Greg Stein <gs...@lyra.org> on 2000/04/13 19:50:12 UTC
Re: cvs commit: apache-2.0/src/lib/apr/misc/win32 start.c
On 13 Apr 2000 stoddard@locus.apache.org wrote:
>...
> Log:
> Win32: Add code to perform latebinding on functions that may
> not exist on all levels of Windows where Apache runs. This
> is needed to allow Apache to start-up on Win95/98. All calls
> to non portable functions should be protected with
> ap_oslevel checks to prevent runtime segfaults.
>...
> @@ -165,6 +165,54 @@
> } ap_oslevel_e;
>
>
> +typedef enum {
> + DLL_WINBASEAPI = 0, // kernel32 From WinBase.h
> + DLL_WINADVAPI = 1, // advapi32 From WinBase.h
> + DLL_WINSOCKAPI = 2, // mswsock From WinSock.h
> + DLL_WINSOCK2API = 3, // ws2_32 From WinSock2.h
> + DLL_defined = 4 // must define as last idx_ + 1
> +} ap_dlltoken_e;
> +
> +FARPROC LoadLateDllFunc(ap_dlltoken_e fnLib, char *fnName, int ordinal);
> +
> +/* The LateFunctionName call WILL fault if the function cannot be loaded */
> +
> +#define DECLARE_LATE_DLL_FUNC(lib, rettype, calltype, fn, ord, args, names) \
> + typedef rettype (calltype *fpt##fn) args; \
> + static fpt##fn pfn##fn; \
For safety, shouldn't this be initialized to NULL?
>...
> +/* This is the helper code to resolve late bound entry points
> + * missing from one or more releases of the Win32 API
> + */
> +
> +static char *lateDllName[DLL_defined] = {
> + "kernel32", "advapi32", "mswsock", "ws2_32" };
This could be "const char * const", right?
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
RE: cvs commit: apache-2.0/src/lib/apr/misc/win32 start.c
Posted by "William A. Rowe, Jr." <wr...@lnd.com>.
> From: Greg Stein [mailto:gstein@lyra.org]
> Sent: Thursday, April 13, 2000 12:50 PM
>
> On 13 Apr 2000 stoddard@locus.apache.org wrote:
> >...
> > Log:
> > Win32: Add code to perform latebinding on functions that may
> > not exist on all levels of Windows where Apache runs. This
> > is needed to allow Apache to start-up on Win95/98. All calls
> > to non portable functions should be protected with
> > ap_oslevel checks to prevent runtime segfaults.
> >...
> > @@ -165,6 +165,54 @@
> > } ap_oslevel_e;
> >
> >
> > +typedef enum {
> > + DLL_WINBASEAPI = 0, // kernel32 From WinBase.h
> > + DLL_WINADVAPI = 1, // advapi32 From WinBase.h
> > + DLL_WINSOCKAPI = 2, // mswsock From WinSock.h
> > + DLL_WINSOCK2API = 3, // ws2_32 From WinSock2.h
> > + DLL_defined = 4 // must define as last idx_ + 1
> > +} ap_dlltoken_e;
> > +
> > +FARPROC LoadLateDllFunc(ap_dlltoken_e fnLib, char
> *fnName, int ordinal);
> > +
> > +/* The LateFunctionName call WILL fault if the function
> cannot be loaded */
> > +
> > +#define DECLARE_LATE_DLL_FUNC(lib, rettype, calltype,
> fn, ord, args, names) \
> > + typedef rettype (calltype *fpt##fn) args; \
> > + static fpt##fn pfn##fn; \
>
> For safety, shouldn't this be initialized to NULL?
Yes, it can, although as I said, initialization sequences of
statics got awfully strange in the c++ original code.
Commit it: static fpt##fn pfn##fn = NULL;
>
> >...
> > +/* This is the helper code to resolve late bound entry points
> > + * missing from one or more releases of the Win32 API
> > + */
> > +
> > +static char *lateDllName[DLL_defined] = {
> > + "kernel32", "advapi32", "mswsock", "ws2_32" };
>
> This could be "const char * const", right?
Should work... I'll test it.
RE: cvs commit: apache-2.0/src/lib/apr/misc/win32 start.c
Posted by "William A. Rowe, Jr." <wr...@lnd.com>.
> From: Greg Stein [mailto:gstein@lyra.org]
> Sent: Thursday, April 13, 2000 12:50 PM
>
> >...
> > +/* This is the helper code to resolve late bound entry points
> > + * missing from one or more releases of the Win32 API
> > + */
> > +
> > +static char *lateDllName[DLL_defined] = {
> > + "kernel32", "advapi32", "mswsock", "ws2_32" };
>
> This could be "const char * const", right?
Tested out well, commit this 'typeo' as well
const char * const lateDllName[DLL_defined] = {