rbb 02/03/20 11:45:02
Modified: . CHANGES
dso/unix dso.c
Log:
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 <[EMAIL PROTECTED]>
Reviewed by: Ryan Bloom
Revision Changes Path
1.243 +5 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.242
retrieving revision 1.243
diff -u -r1.242 -r1.243
--- CHANGES 16 Mar 2002 03:54:00 -0000 1.242
+++ CHANGES 20 Mar 2002 19:45:02 -0000 1.243
@@ -1,5 +1,10 @@
Changes with APR b1
+ *) Load libraries if they not MH_BUNDLE, but if they are not, it
+ just attempts to link them as shared libs.
+ [Pier Fumagalli <[EMAIL PROTECTED]>]
+
+
*) apr_atomic_dec now returns a zero value if the value of
the atomic is zero, non-zero otherwise [Ian Holsman]
1.49 +25 -11 apr/dso/unix/dso.c
Index: dso.c
===================================================================
RCS file: /home/cvs/apr/dso/unix/dso.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- dso.c 13 Mar 2002 20:39:09 -0000 1.48
+++ dso.c 20 Mar 2002 19:45:02 -0000 1.49
@@ -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 @@
#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 @@
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 @@
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