[Openmcl-cvs-notifications] r13375 - /trunk/source/lisp-kernel/pmcl-kernel.c

rme at clozure.com rme at clozure.com
Mon Jan 11 19:33:30 UTC 2010


Author: rme
Date: Mon Jan 11 19:33:29 2010
New Revision: 13375

Log:
xFindSymbol, xGetSharedLibrary: delete some obsolete Darwin-specific
that has been #ifdef'd out for some time.

Modified:
    trunk/source/lisp-kernel/pmcl-kernel.c

Modified: trunk/source/lisp-kernel/pmcl-kernel.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/pmcl-kernel.c (original)
+++ trunk/source/lisp-kernel/pmcl-kernel.c Mon Jan 11 19:33:29 2010
@@ -2052,95 +2052,8 @@
 void *
 xGetSharedLibrary(char *path, int *resultType)
 {
-#if 0
-  NSObjectFileImageReturnCode code;
-  NSObjectFileImage	         moduleImage;
-  NSModule		         module;
-  const struct mach_header *     header;
-  const char *                   error;
-  void *                         result;
-  /* not thread safe */
-  /*
-  static struct {
-    const struct mach_header  *header;
-    NSModule	              *module;
-    const char                *error;
-  } results;	=

-  */
-  result =3D NULL;
-  error =3D NULL;
-
-  /* first try to open this as a bundle */
-  code =3D NSCreateObjectFileImageFromFile(path,&moduleImage);
-  if (code !=3D NSObjectFileImageSuccess &&
-      code !=3D NSObjectFileImageInappropriateFile &&
-      code !=3D NSObjectFileImageAccess)
-    {
-      /* compute error strings */
-      switch (code)
-	{
-	case NSObjectFileImageFailure:
-	  error =3D "NSObjectFileImageFailure";
-	  break;
-	case NSObjectFileImageArch:
-	  error =3D "NSObjectFileImageArch";
-	  break;
-	case NSObjectFileImageFormat:
-	  error =3D "NSObjectFileImageFormat";
-	  break;
-	case NSObjectFileImageAccess:
-	  /* can't find the file */
-	  error =3D "NSObjectFileImageAccess";
-	  break;
-	default:
-	  error =3D "unknown error";
-	}
-      *resultType =3D 0;
-      return (void *)error;
-    }
-  if (code =3D=3D NSObjectFileImageInappropriateFile ||
-      code =3D=3D NSObjectFileImageAccess ) {
-    /* the pathname might be a partial pathane (hence the access error)
-       or it might be something other than a bundle, if so perhaps
-       it is a .dylib so now try to open it as a .dylib */
-
-    /* protect against redundant loads, Gary Byers noticed possible
-       heap corruption if this isn't done */
-    header =3D NSAddImage(path, NSADDIMAGE_OPTION_RETURN_ON_ERROR |
-			NSADDIMAGE_OPTION_WITH_SEARCHING |
-			NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED);
-    if (!header)
-      header =3D NSAddImage(path, NSADDIMAGE_OPTION_RETURN_ON_ERROR |
-			  NSADDIMAGE_OPTION_WITH_SEARCHING);
-    result =3D (void *)header;
-    *resultType =3D 1;
-  }
-  else if (code =3D=3D NSObjectFileImageSuccess) {
-    /* we have a sucessful module image
-       try to link it, don't bind symbols privately */
-
-    module =3D NSLinkModule(moduleImage, path,
-			  NSLINKMODULE_OPTION_RETURN_ON_ERROR | NSLINKMODULE_OPTION_BINDNOW);
-    NSDestroyObjectFileImage(moduleImage);	=

-    result =3D (void *)module;
-    *resultType =3D 2;
-  }
-  if (!result)
-    {
-      /* compute error string */
-      NSLinkEditErrors ler;
-      int lerno;
-      const char* file;
-      NSLinkEditError(&ler,&lerno,&file,&error);
-      if (error) {
-	result =3D (void *)error;
-	*resultType =3D 0;
-      }
-    }
-  return result;
-#else
-  const char *                   error;
-  void *                         result;
+  const char *error;
+  void *result;
 =

   result =3D dlopen(path, RTLD_NOW | RTLD_GLOBAL);
   =

@@ -2151,7 +2064,6 @@
   }
   *resultType =3D 1;
   return result;
-#endif
 }
 #endif
 =

@@ -2310,7 +2222,6 @@
   return dlsym(handle, name);
 #endif
 #ifdef DARWIN
-#if 1
   void *result;
 =

   if ((handle =3D=3D NULL) || (handle =3D=3D ((void *) -1))) {
@@ -2321,19 +2232,6 @@
     result =3D dlsym(handle, name+1);
   }
   return result;
-#else
-  natural address =3D 0;
-
-  if ((handle =3D=3D NULL) ||
-      (handle =3D=3D (void *)-1) ||
-      (handle =3D=3D (void *)-2)){
-    if (NSIsSymbolNameDefined(name)) { /* Keep dyld_lookup from crashing */
-      _dyld_lookup_and_bind(name, (void *) &address, (void*) NULL);
-    }
-    return (void *)address;
-  }
-  Bug(NULL, "How did this happen ?");
-#endif
 #endif
 #ifdef WINDOWS
   extern void *windows_find_symbol(void *, char *);



More information about the Openmcl-cvs-notifications mailing list