summaryrefslogtreecommitdiff
path: root/soltools
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2006-01-20 12:28:50 +0000
committerOliver Bolte <obo@openoffice.org>2006-01-20 12:28:50 +0000
commit56dcf9acb5e40449eb3ba7a371866699d146a30c (patch)
treeeeb5f69853cb49546fb3c4712993657c7c80f4d8 /soltools
parent4943f76bab034168d2d6cf680375f2c93aa6eefa (diff)
INTEGRATION: CWS macosx20xfixes01 (1.8.6); FILE MERGED
2006/01/15 18:44:58 tra 1.8.6.2: #i55863# some code beautifying 2005/10/27 18:38:05 tra 1.8.6.1: #i55863# using the standard Unix dylib functions in favor of the Mac OS X specific APIs like NSAddImage etc. Apple has deprecated the use of the Mac OS X specific functions and suggests to use the standard functions on Mac OS X 10.3 and higher. See Apple developer documentation
Diffstat (limited to 'soltools')
-rw-r--r--soltools/checkdll/checkdll.c53
1 files changed, 2 insertions, 51 deletions
diff --git a/soltools/checkdll/checkdll.c b/soltools/checkdll/checkdll.c
index 3bc53fa1fa0c..11c7583f06ea 100644
--- a/soltools/checkdll/checkdll.c
+++ b/soltools/checkdll/checkdll.c
@@ -4,9 +4,9 @@
*
* $RCSfile: checkdll.c,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: rt $ $Date: 2005-09-08 07:22:57 $
+ * last change: $Author: obo $ $Date: 2006-01-20 13:28:50 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -38,11 +38,7 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
-#ifdef MACOSX
-#include <mach-o/dyld.h>
-#else
#include <dlfcn.h>
-#endif
/*
* NOTE: Since no one is really interested in correct unload behavior I've
@@ -63,11 +59,7 @@ void usage()
int main(int argc, char *argv[])
{
int rc;
-#ifdef MACOSX
- struct mach_header *pLib;
-#else
void *phandle;
-#endif
char *(*pfun)(void);
if ( argc < 2 || argc > 3) {
@@ -84,45 +76,6 @@ int main(int argc, char *argv[])
printf("Checking DLL %s ...", argv[1]);
fflush(stdout);
-#ifdef MACOSX
-
- // Check if library is already loaded
- pLib = NSAddImage(argv[1], NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED);
- if (!pLib) {
- // Check DYLD_LIBRARY_PATH
- pLib = NSAddImage(argv[1], NSADDIMAGE_OPTION_WITH_SEARCHING);
- }
- if (pLib) {
- // Prefix symbol name with '_'
- int len = strlen(psymbol);
- char *name = malloc(1+len+1);
- NSSymbol *symbol;
- void *address = NULL;
- strncpy(name, "_", 2);
- strncat(name, psymbol, len);
- symbol = NSLookupSymbolInImage(pLib, name, NSLOOKUPSYMBOLINIMAGE_OPTION_BIND);
- free(name);
- if (symbol) address = NSAddressOfSymbol(symbol);
- if (address != NULL) {
- printf(": ok\n");
-#ifdef NO_UNLOAD_CHECK
- _exit(0);
-#else
- // Mac OS X can't unload dylibs
-#endif
- } else {
- printf(": WARNING: symbol %s not found\n", psymbol);
- }
- return 0;
- } else {
- printf(": WARNING: %s is not a valid dylib name\n", argv[1]);
- }
- return 3;
-
- // fixme use NSLinkEditError() for better error messages
-
-#else /* MACOSX */
-
if ( (phandle = dlopen(argv[1], RTLD_NOW)) != NULL ) {
if ( (pfun = (char *(*)(void))dlsym(phandle, psymbol)) != NULL ) {
printf(": ok\n");
@@ -141,8 +94,6 @@ int main(int argc, char *argv[])
printf(": ERROR: %s\n", dlerror());
return 3;
-
-#endif /* MACOSX */
}