From 6768ef5becaf51f482251066d231e6c71fb0412c Mon Sep 17 00:00:00 2001 From: Justin Erenkrantz Date: Mon, 24 Jun 2002 07:01:19 +0000 Subject: Correct shared library support on Darwin to not fatally error out when a shared library does not exist. This does retain the Mach-O bundle and Mach-O dynamically linked shared library support on Darwin. Also improvements relating to testdso: - Get testdso to actually link. - Add support for a second DSO to load in testdso. - Build mod_test.slo and libmod_test.slo with and without the -module option. This checks that both types of dynamic libraries can be loaded. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@63521 13f79535-47bb-0310-9956-ffa450edef68 --- dso/unix/dso.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'dso') diff --git a/dso/unix/dso.c b/dso/unix/dso.c index a6d3860e2..8f97b7555 100644 --- a/dso/unix/dso.c +++ b/dso/unix/dso.c @@ -124,8 +124,11 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, #elif defined(DSO_USE_DYLD) NSObjectFileImage image; NSModule os_handle = NULL; + NSObjectFileImageReturnCode dsoerr; char* err_msg = NULL; - if (NSCreateObjectFileImageFromFile(path, &image) == NSObjectFileImageSuccess) { + dsoerr = NSCreateObjectFileImageFromFile(path, &image); + + if (dsoerr == NSObjectFileImageSuccess) { #if defined(NSLINKMODULE_OPTION_RETURN_ON_ERROR) && defined(NSLINKMODULE_OPTION_NONE) os_handle = NSLinkModule(image, path, NSLINKMODULE_OPTION_RETURN_ON_ERROR | @@ -135,7 +138,9 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, #endif NSDestroyObjectFileImage(image); } - else if (NSAddLibrary(path) == TRUE) { + else if ((dsoerr == NSObjectFileImageFormat || + dsoerr == NSObjectFileImageInappropriateFile) && + NSAddLibrary(path) == TRUE) { os_handle = (NSModule)DYLD_LIBRARY_HANDLE; } else { -- cgit v1.2.1