In Darwin, the preferred way to build shared libraries is with two level
namespaces. The following patch makes it possible to build the ruby shared
library in this fashion.

I would really like to see this integrated. This patch was created against
the 1.6 source. If a patch against the 1.7 source is needed, please let me
know.

diff -ruN ruby.orig/eval.c ruby/eval.c
--- ruby.orig/eval.c	Mon May 27 10:59:43 2002
+++ ruby/eval.c	Fri Oct 11 12:51:54 2002
@@ -23,6 +23,10 @@
 #include "st.h"
 #include "dln.h"
 
+#ifdef __APPLE__
+#include <crt_externs.h>
+#endif
+
 /* Make alloca work the best possible way.  */
 #ifdef __GNUC__
 # ifndef atarist
@@ -1008,6 +1012,8 @@
 
 #ifdef __MACOS__
     rb_origenviron = 0;
+#elif defined(__APPLE__)
+    rb_origenviron = *_NSGetEnviron();
 #else
     rb_origenviron = environ;
 #endif
diff -ruN ruby.orig/hash.c ruby/hash.c
--- ruby.orig/hash.c	Mon May 27 10:59:43 2002
+++ ruby/hash.c	Fri Oct 11 12:51:48 2002
@@ -17,6 +17,10 @@
 #include "util.h"
 #include "rubysig.h"
 
+#ifdef __APPLE__
+#include <crt_externs.h>
+#endif
+
 #define HASH_DELETED  FL_USER1
 
 static void
@@ -861,6 +865,11 @@
 static char **my_environ;
 #undef environ
 #define environ my_environ
+#elif defined(__APPLE__)
+#undef environ
+#define environ *_NSGetEnviron()
+#define GET_ENVIRON(e) (e)
+#define FREE_ENVIRON(e)
 #else
 extern char **environ;
 #define GET_ENVIRON(e) (e)