summaryrefslogtreecommitdiffstats
path: root/dln.c
diff options
context:
space:
mode:
Diffstat (limited to 'dln.c')
-rw-r--r--dln.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/dln.c b/dln.c
index 221e1a1f2..3dce788c3 100644
--- a/dln.c
+++ b/dln.c
@@ -81,19 +81,28 @@ char *getenv();
# include "macruby_private.h"
#endif
+#if defined(__APPLE__) && defined(__MACH__) /* Mac OS X */
+# if defined(HAVE_DLOPEN)
+ /* Mac OS X with dlopen (10.3 or later) */
+# define MACOSX_DLOPEN
+# else
+# define MACOSX_DYLD
+# endif
+#endif
+
#ifdef __BEOS__
# include <image.h>
#endif
#ifndef NO_DLN_LOAD
-#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(__APPLE__) && !defined(_UNICOSMP)
+#if defined(HAVE_DLOPEN) && !defined(USE_DLN_A_OUT) && !defined(_AIX) && !defined(MACOSX_DYLD) && !defined(_UNICOSMP)
/* dynamic load with dlopen() */
# define USE_DLN_DLOPEN
#endif
#ifndef FUNCNAME_PATTERN
-# if defined(__hp9000s300) || (defined(__NetBSD__) && !defined(__ELF__)) || defined(__BORLANDC__) || (defined(__FreeBSD__) && !defined(__ELF__)) || (defined(__OpenBSD__) && !defined(__ELF__)) || defined(NeXT) || defined(__WATCOMC__) || defined(__APPLE__)
+# if defined(__hp9000s300) || (defined(__NetBSD__) && !defined(__ELF__)) || defined(__BORLANDC__) || (defined(__FreeBSD__) && !defined(__ELF__)) || (defined(__OpenBSD__) && !defined(__ELF__)) || defined(NeXT) || defined(__WATCOMC__) || defined(MACOSX_DYLD)
# define FUNCNAME_PATTERN "_Init_%s"
# else
# define FUNCNAME_PATTERN "Init_%s"
@@ -1097,7 +1106,7 @@ dln_sym(const char *name)
#endif
#endif
#else
-#ifdef __APPLE__
+#ifdef MACOSX_DYLD
#include <mach-o/dyld.h>
#endif
#endif
@@ -1345,7 +1354,7 @@ dln_load(const char *file)
}
#endif /* _AIX */
-#if defined(NeXT) || defined(__APPLE__)
+#if defined(NeXT) || defined(MACOSX_DYLD)
#define DLN_DEFINED
/*----------------------------------------------------
By SHIROYAMA Takayuki Psi@fortune.nest.or.jp
@@ -1469,7 +1478,7 @@ dln_load(const char *file)
}
#endif /* __BEOS__*/
-#ifdef __MACOS__
+#ifdef __MACOS__ /* Mac OS 9 or before */
# define DLN_DEFINED
{
OSErr err;