summaryrefslogtreecommitdiff
path: root/dso/unix
diff options
context:
space:
mode:
authorrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2002-03-20 19:45:02 +0000
committerrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2002-03-20 19:45:02 +0000
commit5a94cffd3f8e09b0f7bf0d280d4369df678b5106 (patch)
treeafec4aae5348fe08d13af9b41412402791dd9fca /dso/unix
parent94896160f86c41aa75690a9c0675d3f9b12261a9 (diff)
downloadlibapr-5a94cffd3f8e09b0f7bf0d280d4369df678b5106.tar.gz
Load libraries if they not MH_BUNDLE, but if they are not, it
just attempts to link them as shared libs. This is required to get the JVM loaded through APR. Submitted by: Pier Fumagalli <pier@betaversion.org> Reviewed by: Ryan Bloom git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63166 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dso/unix')
-rw-r--r--dso/unix/dso.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/dso/unix/dso.c b/dso/unix/dso.c
index 69fd8c401..944fafe15 100644
--- a/dso/unix/dso.c
+++ b/dso/unix/dso.c
@@ -72,6 +72,10 @@
#include <string.h> /* for strerror() on HP-UX */
#endif
+#if defined(DSO_USE_DYLD)
+#define DYLD_LIBRARY_HANDLE (void *)-1
+#endif
+
APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso,
apr_os_dso_handle_t osdso,
apr_pool_t *pool)
@@ -99,7 +103,9 @@ static apr_status_t dso_cleanup(void *thedso)
#if defined(DSO_USE_SHL)
shl_unload((shl_t)dso->handle);
#elif defined(DSO_USE_DYLD)
- NSUnLinkModule(dso->handle, FALSE);
+ if (dso->handle != DYLD_LIBRARY_HANDLE) {
+ NSUnLinkModule(dso->handle, FALSE);
+ }
#elif defined(DSO_USE_DLFCN)
if (dlclose(dso->handle) != 0)
return APR_EINIT;
@@ -119,18 +125,21 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
NSObjectFileImage image;
NSModule os_handle = NULL;
char* err_msg = NULL;
- if (NSCreateObjectFileImageFromFile(path, &image) != NSObjectFileImageSuccess) {
- err_msg = "cannot create object file image";
- }
- else {
+ if (NSCreateObjectFileImageFromFile(path, &image) == NSObjectFileImageSuccess) {
#ifdef NSLINKMODULE_OPTION_PRIVATE
- os_handle = NSLinkModule(image, path,
- NSLINKMODULE_OPTION_PRIVATE |
- NSLINKMODULE_OPTION_RETURN_ON_ERROR);
+ os_handle = NSLinkModule(image, path,
+ NSLINKMODULE_OPTION_PRIVATE |
+ NSLINKMODULE_OPTION_RETURN_ON_ERROR);
#else
- os_handle = NSLinkModule(image, path, TRUE);
+ os_handle = NSLinkModule(image, path, TRUE);
#endif
- NSDestroyObjectFileImage(image);
+ NSDestroyObjectFileImage(image);
+ }
+ else if (NSAddLibrary(path) == TRUE) {
+ os_handle = (NSModule)DYLD_LIBRARY_HANDLE;
+ }
+ else {
+ err_msg = "cannot create object file image or add library";
}
#elif defined(DSO_USE_DLFCN)
@@ -208,7 +217,12 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
char *symname2 = (char*)malloc(sizeof(char)*(strlen(symname)+2));
sprintf(symname2, "_%s", symname);
#ifdef NSLINKMODULE_OPTION_PRIVATE
- symbol = NSLookupSymbolInModule((NSModule)handle->handle, symname2);
+ if (handle->handle == DYLD_LIBRARY_HANDLE) {
+ symbol = NSLookupAndBindSymbol(symname2);
+ }
+ else {
+ symbol = NSLookupSymbolInModule((NSModule)handle->handle, symname2);
+ }
#else
symbol = NSLookupAndBindSymbol(symname2);
#endif