Thread View: borland.public.cppbuilder.internet.web
5 messages
5 total messages
Started by Matt Lowe
Fri, 19 May 2006 15:17
Problems with simple Apache module dll
Author: Matt Lowe
Date: Fri, 19 May 2006 15:17
Date: Fri, 19 May 2006 15:17
68 lines
2360 bytes
2360 bytes
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
Re: Problems with simple Apache module dll
Author: Matt Lowe
Date: Fri, 19 May 2006 16:09
Date: Fri, 19 May 2006 16:09
14 lines
1377 bytes
1377 bytes
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@milsoft.com> wrote in message news:446de17a$1@newsgroups.borland.com... > 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. >
Re: Problems with simple Apache module dll
Author: Michel Leunen
Date: Fri, 19 May 2006 19:08
Date: Fri, 19 May 2006 19:08
16 lines
1463 bytes
1463 bytes
Matt Lowe wrote: > 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/ ----------------------------------------
Re: Problems with simple Apache module dll
Author: Matt Lowe
Date: Tue, 23 May 2006 17:35
Date: Tue, 23 May 2006 17:35
26 lines
1622 bytes
1622 bytes
>> 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
Re: Problems with simple Apache module dll
Author: Michel Leunen
Date: Tue, 23 May 2006 18:31
Date: Tue, 23 May 2006 18:31
17 lines
1657 bytes
1657 bytes
Matt Lowe wrote: > 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/ ----------------------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads