00001 // =========================================================================== 00002 // Copyright (C) 2004-2005 Commonwealth Scientific and Industrial Research 00003 // Organisation (CSIRO) Australia 00004 // 00005 // Redistribution and use in source and binary forms, with or without 00006 // modification, are permitted provided that the following conditions 00007 // are met: 00008 // 00009 // - Redistributions of source code must retain the above copyright 00010 // notice, this list of conditions and the following disclaimer. 00011 // 00012 // - Redistributions in binary form must reproduce the above copyright 00013 // notice, this list of conditions and the following disclaimer in the 00014 // documentation and/or other materials provided with the distribution. 00015 // 00016 // - Neither the name of Zentaro Kavanagh, CSIRO Australia nor the names of 00017 // contributors may be used to endorse or promote products derived from 00018 // this software without specific prior written permission. 00019 // 00020 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00021 // ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00022 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00023 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR 00024 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00025 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00026 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00027 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00028 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00029 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00030 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 // =========================================================================== 00032 00033 #pragma once 00034 00035 00036 /* Apache expects its modules to use a __cdecl calling convention on Windows 00037 but we link to many libraries which are __stdcall, so it's more convenient 00038 for us to generate code defaulting to __stdcall. This means, however, that 00039 we need to declare any entry points into the module as __cdecl. Thus, prefix 00040 add the AP_MODULE_ENTRY_POINT macro below to any functions which Apache 00041 is responsible for calling. 00042 */ 00043 00044 #ifdef WIN32 00045 # define AP_MODULE_ENTRY_POINT __cdecl 00046 # define C_FUNCTION_POINTER __cdecl 00047 #else 00048 # define AP_MODULE_ENTRY_POINT 00049 # define C_FUNCTION_POINTER 00050 #endif 00051 00052 00053 /* We also need to override the function typedefs in the Apache header files, 00054 because the included Apache headers will think our functions are __stdcall, 00055 rather than __cdecl, which is what they actually are. So, we need to typecast 00056 the function prototype into fooling the Apache headers that we're __stdcall. 00057 Ouch. Use the macros below to do this. 00058 */ 00059 00060 #ifdef WIN32 00061 # define AP_HOOK_HANDLER_FUNCTION(x) (ap_HOOK_handler_t (__stdcall *)) x 00062 #else 00063 # define AP_HOOK_HANDLER_FUNCTION(x) x 00064 #endif 00065 00066 #ifdef WIN32 00067 # define AP_REGISTER_HOOK_FUNCTION(x) (void (__stdcall *)(apr_pool_t *)) x 00068 #else 00069 # define AP_REGISTER_HOOK_FUNCTION(x) x 00070 #endif 00071 00072 /* One final note: remember to extern "C" any functions that are entry points 00073 into the module, and also to append AP_MODULE_DECLARE_DATA after your 00074 module declaration! (See http://httpd.apache.org/docs-2.0/mod/mod_so.html 00075 for more information about the latter.) 00076 */ 00077