From 98a31028f1bc06c95d9dc780d5a6103fe1c69026 Mon Sep 17 00:00:00 2001 From: rbb Date: Fri, 12 Jan 2001 04:50:31 +0000 Subject: Add linkage declarations to the DSO functions. Submitted by: Gregory Nicholls git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61055 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ dso/aix/dso.c | 12 ++++++------ dso/beos/dso.c | 8 ++++---- dso/os2/dso.c | 12 ++++++------ dso/os390/dso.c | 14 +++++++------- dso/unix/dso.c | 14 +++++++------- dso/win32/dso.c | 10 +++++----- include/apr_dso.h | 14 ++++++++------ 8 files changed, 46 insertions(+), 41 deletions(-) diff --git a/CHANGES b/CHANGES index bb074b562..04eb86593 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ Changes with APR b1 + *) Add linkage declarations to the DSO code. + [Gregory Nicholls ] + *) Some adjustment of hints.m4 setting flags (used to check if null first) and added some verbosity. [Jim Jagielski] diff --git a/dso/aix/dso.c b/dso/aix/dso.c index 4b10f1fe3..cd63af0b1 100644 --- a/dso/aix/dso.c +++ b/dso/aix/dso.c @@ -132,8 +132,8 @@ struct dl_info { * add the basic "wrappers" here. */ -apr_status_t apr_dso_load(apr_dso_handle_t **res_handle, const char *path, - apr_pool_t *ctx) +APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, + const char *path, apr_pool_t *ctx) { void *os_handle = dlopen((char *)path, RTLD_NOW | RTLD_GLOBAL); @@ -146,7 +146,7 @@ apr_status_t apr_dso_load(apr_dso_handle_t **res_handle, const char *path, return APR_SUCCESS; } -apr_status_t apr_dso_unload(apr_dso_handle_t *handle) +APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle) { if (dlclose(handle->handle) != 0) return APR_EINIT; @@ -154,9 +154,9 @@ apr_status_t apr_dso_unload(apr_dso_handle_t *handle) return APR_SUCCESS; } -apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym, - apr_dso_handle_t *handle, - const char *symname) +APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, + apr_dso_handle_t *handle, + const char *symname) { void *retval = dlsym(handle->handle, symname); diff --git a/dso/beos/dso.c b/dso/beos/dso.c index f049c28a4..bb01d858c 100644 --- a/dso/beos/dso.c +++ b/dso/beos/dso.c @@ -56,7 +56,7 @@ #if APR_HAS_DSO -apr_status_t apr_dso_load(apr_dso_handle_t **res_handle, const char *path, +APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, const char *path, apr_pool_t *ctx) { image_id newid; @@ -70,7 +70,7 @@ apr_status_t apr_dso_load(apr_dso_handle_t **res_handle, const char *path, return APR_SUCCESS; } -apr_status_t apr_dso_unload(apr_dso_handle_t *handle) +APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle) { if(unload_add_on(handle->handle) < B_NO_ERROR) return APR_EINIT; @@ -78,7 +78,7 @@ apr_status_t apr_dso_unload(apr_dso_handle_t *handle) return APR_SUCCESS; } -apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym, apr_dso_handle_t *handle, +APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, apr_dso_handle_t *handle, const char *symname) { int err; @@ -95,7 +95,7 @@ apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym, apr_dso_handle_t *handle, return APR_SUCCESS; } -const char *apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr_size_t buflen) +APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr_size_t buflen) { strncpy(strerror(errno), buffer, buflen); return buffer; diff --git a/dso/os2/dso.c b/dso/os2/dso.c index d3eb678bb..03dcecae2 100644 --- a/dso/os2/dso.c +++ b/dso/os2/dso.c @@ -68,7 +68,7 @@ static apr_status_t dso_cleanup(void *thedso) } -apr_status_t apr_dso_load(apr_dso_handle_t **res_handle, const char *path, apr_pool_t *ctx) +APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, const char *path, apr_pool_t *ctx) { char failed_module[200]; HMODULE handle; @@ -92,7 +92,7 @@ apr_status_t apr_dso_load(apr_dso_handle_t **res_handle, const char *path, apr_p -apr_status_t apr_dso_unload(apr_dso_handle_t *handle) +APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle) { int rc; @@ -109,9 +109,9 @@ apr_status_t apr_dso_unload(apr_dso_handle_t *handle) -apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym, - apr_dso_handle_t *handle, - const char *symname) +APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, + apr_dso_handle_t *handle, + const char *symname) { PFN func; int rc; @@ -128,7 +128,7 @@ apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym, -const char *apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr_size_t buflen) +APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr_size_t buflen) { char message[200]; apr_strerror(dso->load_error, message, sizeof(message)); diff --git a/dso/os390/dso.c b/dso/os390/dso.c index 2adff3e8d..1f4fda65a 100644 --- a/dso/os390/dso.c +++ b/dso/os390/dso.c @@ -65,8 +65,8 @@ static apr_status_t dso_cleanup(void *thedso) return apr_dso_unload(dso); } -apr_status_t apr_dso_load(apr_dso_handle_t **res_handle, const char *path, - apr_pool_t *ctx) +APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, + const char *path, apr_pool_t *ctx) { dllhandle *handle; int rc; @@ -83,7 +83,7 @@ apr_status_t apr_dso_load(apr_dso_handle_t **res_handle, const char *path, return errno; } -apr_status_t apr_dso_unload(apr_dso_handle_t *handle) +APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle) { int rc; @@ -100,9 +100,9 @@ apr_status_t apr_dso_unload(apr_dso_handle_t *handle) return errno; } -apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym, - apr_dso_handle_t *handle, - const char *symname) +APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, + apr_dso_handle_t *handle, + const char *symname) { void *func_ptr; void *var_ptr; @@ -119,7 +119,7 @@ apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym, return errno; } -const char *apr_dso_error(apr_dso_handle_t *handle, char *buffer, +APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *handle, char *buffer, apr_size_t buflen) { apr_cpystrn(buffer, strerror(handle->failing_errno), buflen); diff --git a/dso/unix/dso.c b/dso/unix/dso.c index 6741449ab..154a11fb0 100644 --- a/dso/unix/dso.c +++ b/dso/unix/dso.c @@ -61,8 +61,8 @@ #include #endif -apr_status_t apr_dso_load(apr_dso_handle_t **res_handle, const char *path, - apr_pool_t *ctx) +APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, + const char *path, apr_pool_t *ctx) { #if defined(HPUX) || defined(HPUX10) || defined(HPUX11) shl_t os_handle = shl_load(path, BIND_IMMEDIATE|BIND_VERBOSE|BIND_NOSTART, 0L); @@ -91,7 +91,7 @@ apr_status_t apr_dso_load(apr_dso_handle_t **res_handle, const char *path, return APR_SUCCESS; } -apr_status_t apr_dso_unload(apr_dso_handle_t *handle) +APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle) { #if defined(HPUX) || defined(HPUX10) || defined(HPUX11) shl_unload((shl_t)handle->handle); @@ -104,9 +104,9 @@ apr_status_t apr_dso_unload(apr_dso_handle_t *handle) return APR_SUCCESS; } -apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym, - apr_dso_handle_t *handle, - const char *symname) +APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, + apr_dso_handle_t *handle, + const char *symname) { #if defined(HPUX) || defined(HPUX10) || defined(HPUX11) void *symaddr = NULL; @@ -146,7 +146,7 @@ apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym, #endif /* not HP-UX; use dlsym()/dlerror() */ } -const char *apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr_size_t buflen) +APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr_size_t buflen) { if (dso->errormsg) { apr_cpystrn(buffer, dso->errormsg, buflen); diff --git a/dso/win32/dso.c b/dso/win32/dso.c index a6e3dfe5e..3899fa223 100644 --- a/dso/win32/dso.c +++ b/dso/win32/dso.c @@ -59,8 +59,8 @@ #if APR_HAS_DSO -apr_status_t apr_dso_load(struct apr_dso_handle_t **res_handle, const char *path, - apr_pool_t *ctx) +APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, + const char *path, apr_pool_t *ctx) { HINSTANCE os_handle; UINT em; @@ -114,7 +114,7 @@ apr_status_t apr_dso_load(struct apr_dso_handle_t **res_handle, const char *path return APR_SUCCESS; } -apr_status_t apr_dso_unload(struct apr_dso_handle_t *handle) +APR_DECLARE(apr_status_t) apr_dso_unload(struct apr_dso_handle_t *handle) { if (!FreeLibrary(handle->handle)) { return apr_get_os_error(); @@ -122,7 +122,7 @@ apr_status_t apr_dso_unload(struct apr_dso_handle_t *handle) return APR_SUCCESS; } -apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym, +APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, struct apr_dso_handle_t *handle, const char *symname) { @@ -136,7 +136,7 @@ apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym, return APR_SUCCESS; } -const char *apr_dso_error(apr_dso_handle_t *dso, char *buf, apr_size_t bufsize) +APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buf, apr_size_t bufsize) { return apr_strerror(dso->load_error, buf, bufsize); } diff --git a/include/apr_dso.h b/include/apr_dso.h index d2fb03e8a..3eed74422 100644 --- a/include/apr_dso.h +++ b/include/apr_dso.h @@ -87,14 +87,14 @@ typedef void * apr_dso_handle_sym_t; * @param path Path to the DSO library * @param ctx Pool to use. */ -apr_status_t apr_dso_load(apr_dso_handle_t **res_handle, const char *path, - apr_pool_t *ctx); +APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, + const char *path, apr_pool_t *ctx); /** * Close a DSO library. * @param handle handle to close. */ -apr_status_t apr_dso_unload(apr_dso_handle_t *handle); +APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle); /** * Load a symbol from a DSO handle. @@ -102,16 +102,18 @@ apr_status_t apr_dso_unload(apr_dso_handle_t *handle); * @param handle handle to load the symbol from. * @param symname Name of the symbol to load. */ -apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym, apr_dso_handle_t *handle, - const char *symname); +APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, + apr_dso_handle_t *handle, + const char *symname); /** * Report more information when a DSO function fails. * @param dso The dso handle that has been opened * @param buf Location to store the dso error * @param bufsize The size of the provided buffer + * @deffunc const char *apr_dso_error(apr_dso_handle_t *dso, char *buf, apr_size_t bufsize) */ -const char *apr_dso_error(apr_dso_handle_t *dso, char *buf, apr_size_t bufsize); +APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buf, apr_size_t bufsize); #endif /* APR_HAS_DSO */ -- cgit v1.2.1