httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <stodd...@raleigh.ibm.com>
Subject Re: API_EXPORT, etc.
Date Fri, 11 Feb 2000 20:45:03 GMT
> > 2)  Why can't we just let APR define this for us, and let Apache use it?
> I had ruled this when I was thinking of this a month or so ago, I just
can't
> remember why now :-).  Maybe I'll start down this path first and see what
> happens.
Ahh, now I remember. The problem is that we need to declare the macros
differently, depending on which project is including the header files. Here
are the definitions included in win32/os.h

#ifdef SHARED_MODULE
# define API_VAR_EXPORT  __declspec(dllimport)
# define API_EXPORT(type)    __declspec(dllimport) type __stdcall
# define API_EXPORT_NONSTD(type)    __declspec(dllimport) type
#else
# define API_VAR_EXPORT  __declspec(dllexport)
# define API_EXPORT(type)    __declspec(dllexport) type __stdcall
# define API_EXPORT_NONSTD(type)    __declspec(dllexport) type
#endif

Projects defining Apache DSOs should include the definition SHARED_MODULE.
This causes all the functions wrappered in API_* macros to be identified as
residing in a DLL (specifically ApacheCore.dll). All calls to these
functions are saved an indirection because they are declared dllimports.
(BTW, we no longer need the dllexport declarations since we explicitly
export APIs via .def files). If you notice, modules in the modules directory
do not declare any of their functions with API_ macros. APR on the
otherhand, does which is the essence of the probem. ApacheCore wants to
eliminate the extra indirection, so it declares all the APR functions -in
addition to it's own functions- as being imported. ApacheCore declaring its
own functions as imports is bad.

What if we link APR directly into ApacheCore? This is probably not a bad
thing for Apache (keeps us out of DLL Hell.). We would need to copy
aprlib.def into ApacheCore.def and renumber the function calls. Then Apache
can easily use an APR provided definition of the API_ macros. Would still
need the SHARED_MODULE (or APR_SHARED_MODULE) to control whether the macros
are defined as dllimports or dllexports (or null). Are you comfortable with
requiring APR to always be statically linked on Windows?

Bill




Mime
View raw message