 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Matt Lowe Guest
|
Posted: Fri May 19, 2006 4:14 pm Post subject: Problems with simple Apache module dll |
|
|
I'm trying to build a simple test module for Apache 2.2 -- just a plain old
dll, no WebBroker or WebSnap or any of that.
When I try to load the module, I get the following error:
"Can't Locate API module structure 'hello_module' in file
C:/Apache/modules/HelloModule.dll"
So far as I can tell, everything is set up correctly to export hello_module.
(When I build the dll, Depends shows that the symbol "_hello_module" is
being exported.)
So is there a problem with this symbol name? Or is there something else I'm
missing?
The code for the module looks like this:
--Unit1.cpp--
#include <windows.h>
#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*
lpReserved)
{
return 1;
}
extern "C" {
static int hello_handler(request_rec* r)
{
ap_log_error(APLOG_MARK,APLOG_ERR,OK,NULL,"Testing hello handler");
return OK;
}
static void hello_hooks(apr_pool_t* pool)
{
ap_hook_handler(hello_handler, NULL, NULL, APR_HOOK_MIDDLE);
}
module AP_MODULE_DECLARE_DATA hello_module =
{
STANDARD20_MODULE_STUFF,
NULL,
NULL,
NULL,
NULL,
NULL,
hello_hooks
};
}
--
And the interesting part of my httpd.conf looks like this:
LoadModule hello_module modules/HelloModule.dll
<Location /helloc>
SetHandler hello-handler
</Location>
--
Matt Lowe
Milsoft Utility Solutions |
|
| Back to top |
|
 |
Matt Lowe Guest
|
Posted: Fri May 19, 2006 5:14 pm Post subject: Re: Problems with simple Apache module dll |
|
|
Ok, I worked around the problem by changing my httpd.conf:
LoadModule _hello_module modules/HelloModule.dll
But is there a way to get builder to stop decorating the symbol name with
the underscore?
Matt
"Matt Lowe" <dontspammatt (AT) milsoft (DOT) com> wrote in message
news:446de17a$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I'm trying to build a simple test module for Apache 2.2 -- just a plain
old dll, no WebBroker or WebSnap or any of that.
|
|
|
| Back to top |
|
 |
Michel Leunen Guest
|
Posted: Fri May 19, 2006 7:14 pm Post subject: Re: Problems with simple Apache module dll |
|
|
Matt Lowe wrote:
| Quote: | But is there a way to get builder to stop decorating the symbol name with
the underscore?
|
Yes, use the __stdcall calling convention for your exported function. By
default the __cdecl convention is used.
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
---------------------------------------- |
|
| Back to top |
|
 |
Matt Lowe Guest
|
Posted: Tue May 23, 2006 6:14 pm Post subject: Re: Problems with simple Apache module dll |
|
|
| Quote: | But is there a way to get builder to stop decorating the symbol name with
the underscore?
Yes, use the __stdcall calling convention for your exported function. By
default the __cdecl convention is used.
|
hello_module isn't a function, it's a struct. Anyhow, I tried setting
__stdcall, but it doesn't seem to work:
module __stdcall __declspec(dllexport) hello_module =
{
STANDARD20_MODULE_STUFF,
NULL,
NULL,
NULL,
NULL,
NULL,
hello_hooks
};
Setting stdcall in project options doesn't work either. Might there be a
conflict with __declspec?
Thanks,
Matt |
|
| Back to top |
|
 |
Michel Leunen Guest
|
Posted: Tue May 23, 2006 7:14 pm Post subject: Re: Problems with simple Apache module dll |
|
|
Matt Lowe wrote:
| Quote: | hello_module isn't a function, it's a struct.
|
Hopefully someone with a better knowledge of this issue will answer you.
What I know is that exporting classes and therefore struct is compiler
specific. That means that your dll with exported classes will not work
when used with an application build with a different compiler.
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
---------------------------------------- |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|