Mod Cplusplus CVS committal
Author : gr84b8
Project : mod_cplusplus
Module : src
Dir : mod_cplusplus/src
Modified Files:
apache_handler.cpp mod_cplusplus.c
Log Message:
fix up our symbol and so loading logic to be platform independent in preparation for the win32 port
===================================================================
RCS file: /cvsroot/modcplusplus/mod_cplusplus/src/apache_handler.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- apache_handler.cpp 26 Apr 2002 18:57:00 -0000 1.10
+++ apache_handler.cpp 6 May 2002 16:31:31 -0000 1.11
@@ -1,6 +1,6 @@
-#include "dlfcn.h"
#include "apache_handler.h"
#include "apache_protocol.h"
+#include "apr_dso.h"
extern "C" {
@@ -92,26 +92,37 @@
CALL_REQ_FUNCTION(logger);
}
- char *load_cpp_module(cpp_server_rec *server_rec, const char *name,
+ char *load_cpp_module(apr_pool_t *pool,
+ cpp_server_rec *server_rec, const char *name,
const char *path)
{
- void *dlhandle = NULL;
+ apr_dso_handle_t *res_handle;
+ apr_status_t load_status;
+ apr_dso_handle_sym_t ressym;
cpp_factory_t *cur_handler;
- if((dlhandle = dlopen(path, RTLD_NOW)) == NULL){
+
+ load_status = apr_dso_load(&res_handle, path, pool);
+ if( load_status != APR_SUCCESS ) {
+ char load_error[100];
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL,
- "couldn't load so: %s", dlerror());
- return "Coulnd't Load CPP SO";
+ "couldn't load so: %s",
+ apr_dso_error(res_handle, load_error,
+ sizeof(load_error)));
+ return "Couldn't Load CPP SO";
}
- if((cur_handler =
- (cpp_factory_t *)dlsym(dlhandle,
- name)) == NULL){
+ load_status = apr_dso_sym(&ressym,
+ res_handle,
+ name);
+ if( load_status != APR_SUCCESS ) {
+ char load_error[100];
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL,
- "unable to load cpp handler \'%s\': %s",
- path,
- dlerror());
-
- return "Coulnd't Fetch CPP symbol";
+ "couldn't load so: %s",
+ apr_dso_error(res_handle, load_error,
+ sizeof(load_error)));
+ return "Couldn't Find CPP Symbol";
}
+ cur_handler = (cpp_factory_t *)ressym;
+
ApacheHandler *handler = cur_handler->handler_func ?
cur_handler->handler_func() : NULL;
ApacheInputFilter *input_filter = cur_handler->input_filter_func ?
===================================================================
RCS file: /cvsroot/modcplusplus/mod_cplusplus/src/mod_cplusplus.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- mod_cplusplus.c 29 Mar 2002 23:12:58 -0000 1.15
+++ mod_cplusplus.c 6 May 2002 16:31:31 -0000 1.16
@@ -77,7 +77,7 @@
ap_get_module_config(cmd->server->module_config,
&cplusplus_module);
- return load_cpp_module(server_rec, name, path_to_so);
+ return load_cpp_module(cmd->pool, server_rec, name, path_to_so);
}
static const char *pass_var(cmd_parms *cmd, void *config,
|